From 43b9235f66aa56bb884c13443d9e7d56003b5c36 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Mon, 14 May 2018 14:29:15 +1000 Subject: [PATCH] udhcp: fix use of trim() in udhcp_str2optset() trim() modifies the string in place if needed and returns a pointer to the end of the resulting string. Update udhcp_str2optset() so it no longer sets the value of 'val' to the return value of trim(). Signed-off-by: Samuel Mendoza-Jonas Signed-off-by: Denys Vlasenko --- networking/udhcp/common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c index fbf9c6878..b7c04da73 100644 --- a/networking/udhcp/common.c +++ b/networking/udhcp/common.c @@ -489,9 +489,10 @@ int FAST_FUNC udhcp_str2optset(const char *const_str, void *arg, const struct dh int length; char *val; - if (optflag->flags == OPTION_BIN) - val = trim(strtok(NULL, "")); /* do not split "'q w e'" */ - else + if (optflag->flags == OPTION_BIN) { + val = strtok(NULL, ""); /* do not split "'q w e'" */ + trim(val); + } else val = strtok(NULL, ", \t"); if (!val) break; -- 2.25.1