[PATCH 2/2] ifup: fix handling when ip env is not given

Sascha Hauer s.hauer at pengutronix.de
Tue Jun 14 22:43:17 PDT 2016


On Tue, Jun 14, 2016 at 08:55:06AM +0200, Alexander Aring wrote:
> This patch handles the ip env to "" if no ip env is given. Otherwise
> we get a NULL pointer derefence.
> 
> Signed-off-by: Alexander Aring <aar at pengutronix.de>
> ---
>  net/ifup.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/net/ifup.c b/net/ifup.c
> index 17e1b2f..59df069 100644
> --- a/net/ifup.c
> +++ b/net/ifup.c
> @@ -94,6 +94,9 @@ int ifup(const char *name, unsigned flags)
>  		goto out;
>  
>  	ip = getenv("ip");
> +	if (!ip)
> +		ip = "";
> +
>  	if (!strcmp(ip, "dhcp")) {
>  		ret = run_command("dhcp");
>  		if (ret)
> -- 
> 2.8.3
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list