From: Roy Marples Date: Tue, 7 Feb 2023 17:02:29 +0000 (+0000) Subject: options: Fix prior X-Git-Tag: v10.0.0~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11975ad8ddf856602c9923ad296c3fd566218adc;p=thirdparty%2Fdhcpcd.git options: Fix prior For #184. --- diff --git a/src/if-options.c b/src/if-options.c index fdb50706..1ef9cc99 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -190,9 +190,13 @@ add_environ(char ***array, const char *value, int uniq) return NULL; } *p++ = '\0'; + l = strlen(match); while (list && list[i]) { - if (match && strcmp(list[i], match) == 0) { + /* We know that it must contain '=' due to the above test */ + size_t listl = (size_t)(strchr(list[i], '=') - list[i]); + + if (l == listl && strncmp(list[i], match, l) == 0) { if (uniq) { n = strdup(value); if (n == NULL) {