]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
options: Don't assume vsio options have an argument (#578)
authorRoy Marples <roy@marples.name>
Wed, 31 Dec 2025 10:12:24 +0000 (10:12 +0000)
committerGitHub <noreply@github.com>
Wed, 31 Dec 2025 10:12:24 +0000 (10:12 +0000)
* options: Don't assume vsio options have an argument

Should fix #577.

src/if-options.c

index b55e65d6c97dd7383144122696f9b743aaaf03bb..60f8e660651cd09195517ad1e35ee1761a45a5a3 100644 (file)
@@ -936,7 +936,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                return -1;
 #else
                fp = strwhite(arg);
-               if (fp)
+               if (fp != NULL)
                        *fp++ = '\0';
                u = (uint32_t)strtou(arg, NULL, 0, 0, UINT32_MAX, &e);
                if (e) {
@@ -944,9 +944,13 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                        return -1;
                }
 
-               fp = strskipwhite(fp);
-               p = strchr(fp, ',');
-               if (!p || !p[1]) {
+               if (fp != NULL)
+                       fp = strskipwhite(fp);
+               if (fp != NULL)
+                       p = strchr(fp, ',');
+               else
+                       p = NULL;
+               if (p == NULL || p[1] == '\0') {
                        logerrx("invalid vendor format: %s", arg);
                        return -1;
                }