options: Don't assume vsio options have an argument (#578)

* options: Don't assume vsio options have an argument

Should fix #577.
This commit is contained in:
Roy Marples 2025-12-31 10:12:24 +00:00 committed by GitHub
parent 33df3ed00b
commit cd0b26953c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View 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;
}