From: Roy Marples Date: Mon, 25 Jan 2016 10:47:32 +0000 (+0000) Subject: A blank hostname is not a valid hostname X-Git-Tag: v6.10.2~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02e24339a96676246b0dd87ae1cb0a4ef549c152;p=thirdparty%2Fdhcpcd.git A blank hostname is not a valid hostname --- diff --git a/dhcp-common.c b/dhcp-common.c index ff8a959e..c9aff2e2 100644 --- a/dhcp-common.c +++ b/dhcp-common.c @@ -64,10 +64,10 @@ dhcp_get_hostname(char *buf, size_t buf_len, const struct if_options *ifo) strlcpy(buf, ifo->hostname, buf_len); /* Deny sending of these local hostnames */ - if (strcmp(buf, "(none)") == 0 || + if (buf[0] == '\0' || buf[0] == '.' || + strcmp(buf, "(none)") == 0 || strcmp(buf, "localhost") == 0 || - strncmp(buf, "localhost.", strlen("localhost.")) == 0 || - buf[0] == '.') + strncmp(buf, "localhost.", strlen("localhost.")) == 0) return NULL; /* Shorten the hostname if required */