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>
This commit is contained in:
Michal Kazior 2019-09-25 14:03:13 +02:00 committed by Denys Vlasenko
parent 6c1af283f7
commit 1f1988d525

View File

@ -539,7 +539,7 @@ int FAST_FUNC udhcp_str2optset(const char *const_str, void *arg,
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)