1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-06 12:58:22 +03:00

network-generator: allow empty hostname

Fixes #14319.

(cherry picked from commit 21a925a4ac7955e7d7e6cfd477e96d3a2aaee7db)
(cherry picked from commit efd5b1d443fee81a48939e3f86e7feb338f26211)
This commit is contained in:
Yu Watanabe 2019-12-12 19:01:21 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent 165ae6edc6
commit 6d840ca77e

View File

@ -574,7 +574,7 @@ static int parse_netmask_or_prefixlen(int family, const char **value, unsigned c
static int parse_cmdline_ip_address(Context *context, int family, const char *value) {
union in_addr_union addr = {}, peer = {}, gateway = {};
const char *hostname, *ifname, *dhcp_type, *dns, *p;
const char *hostname = NULL, *ifname, *dhcp_type, *dns, *p;
unsigned char prefixlen;
int r;
@ -599,9 +599,11 @@ static int parse_cmdline_ip_address(Context *context, int family, const char *va
if (!p)
return -EINVAL;
if (p != value) {
hostname = strndupa(value, p - value);
if (!hostname_is_valid(hostname, false))
return -EINVAL;
}
value = p + 1;