getsubopt: don't include leading = in value string
authorSteven Barth <cyrus@openwrt.org>
Tue, 18 Aug 2015 09:06:04 +0000 (11:06 +0200)
committerRich Felker <dalias@aerifal.cx>
Fri, 21 Aug 2015 05:29:10 +0000 (01:29 -0400)
getsubopt incorrectly returns the delimiting = in the value string,
this patch fixes it by increasing the pointer position by one.

Signed-off-by: Steven Barth <cyrus@openwrt.org>
src/misc/getsubopt.c

index dac9bf9..53ee957 100644 (file)
@@ -15,7 +15,7 @@ int getsubopt(char **opt, char *const *keys, char **val)
                size_t l = strlen(keys[i]);
                if (strncmp(keys[i], s, l)) continue;
                if (s[l] == '=')
-                       *val = s + l;
+                       *val = s + l + 1;
                else if (s[l]) continue;
                return i;
        }