From 844c377b42446e18f30c981ae3afa8ee87df527a Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 30 Dec 2025 21:45:48 +0000 Subject: [PATCH 1/2] options: Don't assume vsio options have an argument Should fix #577. --- src/if-options.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/if-options.c b/src/if-options.c index b55e65d6..a62dbf7e 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -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,12 @@ 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); + p = strchr(fp, ','); + } else + p = NULL; + if (p == NULL || p[1] == '\0') { logerrx("invalid vendor format: %s", arg); return -1; } From 220f68c8e43e90163edc49e9eb5bbde2c5b6ede7 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 30 Dec 2025 21:52:44 +0000 Subject: [PATCH 2/2] Adjust prior to stop another potential NULL deref --- src/if-options.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/if-options.c b/src/if-options.c index a62dbf7e..60f8e660 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -944,10 +944,11 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, return -1; } - if (fp != NULL) { + if (fp != NULL) fp = strskipwhite(fp); + if (fp != NULL) p = strchr(fp, ','); - } else + else p = NULL; if (p == NULL || p[1] == '\0') { logerrx("invalid vendor format: %s", arg);