summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexander Aring <aar@pengutronix.de>2016-06-14 08:55:06 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-06-15 07:43:01 +0200
commitb0e1847f134e7ec90f41623a8cbe6ce2f941ddde (patch)
treec7400471969517c31e957edf6af1b81f9c58789c /net
parent6ac698af96a59b08e3ede5fea4fa8bf23e847a33 (diff)
downloadbarebox-b0e1847f134e7ec90f41623a8cbe6ce2f941ddde.tar.gz
barebox-b0e1847f134e7ec90f41623a8cbe6ce2f941ddde.tar.xz
ifup: fix handling when ip env is not given
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@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r--net/ifup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ifup.c b/net/ifup.c
index f22afc9a53..30ac3f5861 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -96,6 +96,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)