]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
copy the configured hostname using the buffer length,
authorRoy Marples <roy@marples.name>
Tue, 15 Dec 2015 19:51:49 +0000 (19:51 +0000)
committerRoy Marples <roy@marples.name>
Tue, 15 Dec 2015 19:51:49 +0000 (19:51 +0000)
Not the size of the pointer.
Thanks to Sem.

Fixes [7da8d97fc4].

dhcp-common.c

index b3d0a27e9e4f0ea515477e5274986cd142c3e446..aac24efb04e49cae48c199fa79c31dae726f2b09 100644 (file)
@@ -61,7 +61,7 @@ dhcp_get_hostname(char *buf, size_t buf_len, const struct if_options *ifo)
                        return NULL;
                buf[buf_len - 1] = '\0';
        } else
-               strlcpy(buf, ifo->hostname, sizeof(buf));
+               strlcpy(buf, ifo->hostname, buf_len);
 
        /* Deny sending of these local hostnames */
        if (strcmp(buf, "(none)") == 0 ||