network-generator: refuse unexpected trailing strings

This commit is contained in:
Yu Watanabe
2023-11-08 04:29:45 +09:00
parent 816c269e55
commit b86f60bfb3
2 changed files with 9 additions and 3 deletions
+6 -3
View File
@@ -716,9 +716,6 @@ static int parse_ip_dns_address_one(Context *context, const char *ifname, const
if (r < 0)
return r;
if (p[0] == ':')
p++;
*value = p;
return 0;
}
@@ -808,10 +805,16 @@ static int parse_cmdline_ip_address(Context *context, int family, const char *va
r = parse_ip_dns_address_one(context, ifname, &value);
if (r < 0)
return r;
value += *value == ':';
r = parse_ip_dns_address_one(context, ifname, &value);
if (r < 0)
return r;
/* refuse unexpected trailing strings */
if (!isempty(value))
return -EINVAL;
return 0;
}