Skip to content

Commit cd0b269

Browse files
authored
options: Don't assume vsio options have an argument (#578)
* options: Don't assume vsio options have an argument Should fix #577.
1 parent 33df3ed commit cd0b269

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/if-options.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,17 +936,21 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
936936
return -1;
937937
#else
938938
fp = strwhite(arg);
939-
if (fp)
939+
if (fp != NULL)
940940
*fp++ = '\0';
941941
u = (uint32_t)strtou(arg, NULL, 0, 0, UINT32_MAX, &e);
942942
if (e) {
943943
logerrx("invalid code: %s", arg);
944944
return -1;
945945
}
946946

947-
fp = strskipwhite(fp);
948-
p = strchr(fp, ',');
949-
if (!p || !p[1]) {
947+
if (fp != NULL)
948+
fp = strskipwhite(fp);
949+
if (fp != NULL)
950+
p = strchr(fp, ',');
951+
else
952+
p = NULL;
953+
if (p == NULL || p[1] == '\0') {
950954
logerrx("invalid vendor format: %s", arg);
951955
return -1;
952956
}

0 commit comments

Comments
 (0)