udhcpc: fix segmentation fault on empty bin opt
The following caused udhcpc to segfault:
busybox udhcpc -i lo -s /dev/null -x 0x3d:
function old new delta
udhcp_str2optset 629 641 +12
Signed-off-by: Michal Kazior <michal@plume.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 4a452cd..9ec752d 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -539,7 +539,7 @@
if (optflag->flags == OPTION_BIN) {
val = strtok(NULL, ""); /* do not split "'q w e'" */
- trim(val);
+ if (val) trim(val);
} else
val = strtok(NULL, ", \t");
if (!val)