Fix braino in previous bugfix r300174

The previous revision missed the exact same error in a copy paste block
of the same code in another function.  Fix the identical case, too.

A DHCP client identifier is simply the hardware type (one byte)
concatenated with the hardware address (some variable number of bytes,
but at most 16).  Limit the size of the temporary buffer to match and
the rest of the calculations shake out correctly.

PR:		238022
Reported by:	Young <yangx92 AT hotmail.com>
Submitted by:	Young <yangx92 AT hotmail.com>
MFC after:	I don't plan to but you should feel free
Security:	yes
This commit is contained in:
Conrad Meyer 2019-11-29 03:31:47 +00:00
parent 6d6a03d7a8
commit 74aed808a1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355204

View file

@ -1782,7 +1782,7 @@ make_request(struct interface_info *ip, struct client_lease * lease)
}
/* set unique client identifier */
char client_ident[sizeof(struct hardware)];
char client_ident[sizeof(ip->hw_address.haddr) + 1];
if (!options[DHO_DHCP_CLIENT_IDENTIFIER]) {
int hwlen = (ip->hw_address.hlen < sizeof(client_ident)-1) ?
ip->hw_address.hlen : sizeof(client_ident)-1;