Don't reject packets with server names containing characters that are
not allowed in domain names. RFC 2132 does not list valid or invalid characters and the ISC client accepts anything here. Reported by: ps
This commit is contained in:
parent
a05fe8d0e5
commit
acccb9aa83
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148465
@ -987,7 +987,12 @@ packet_to_lease(struct packet *packet)
|
||||
lease->address.len = sizeof(packet->raw->yiaddr);
|
||||
memcpy(lease->address.iabuf, &packet->raw->yiaddr, lease->address.len);
|
||||
|
||||
/* If the server name was filled out, copy it. */
|
||||
/* If the server name was filled out, copy it.
|
||||
Do not attempt to validate the server name as a host name.
|
||||
RFC 2131 merely states that sname is NUL-terminated (which do
|
||||
do not assume) and that it is the server's host name. Since
|
||||
the ISC client and server allow arbitrary characters, we do
|
||||
as well. */
|
||||
if ((!packet->options[DHO_DHCP_OPTION_OVERLOAD].len ||
|
||||
!(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) &&
|
||||
packet->raw->sname[0]) {
|
||||
@ -999,12 +1004,6 @@ packet_to_lease(struct packet *packet)
|
||||
}
|
||||
memcpy(lease->server_name, packet->raw->sname, DHCP_SNAME_LEN);
|
||||
lease->server_name[DHCP_SNAME_LEN]='\0';
|
||||
if (!res_hnok(lease->server_name) ) {
|
||||
warning("Bogus server name %s", lease->server_name );
|
||||
free_client_lease(lease);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Ditto for the filename. */
|
||||
|
Loading…
Reference in New Issue
Block a user