2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 14:25:41 +00:00

Minor code fixes

[ISC-Bugs #19566] When trying to find the zone for a name for ddns allow
 the name to be at the apex of the zone.
 [ISC-Bugs #19617] Restrict length of interface name read from command line
 in dhcpd - based on a patch from David Cantrell at Red Hat.
 [ISC-Bugs #20039] Correct some error messages in dhcpd.c
 [ISC-Bugs #20070] Better range check on values when creating a DHCID.
 [ISC-Bugs #20198] Avoid writing past the end of the field when adding
 overly long file or server names to a packet and add a log message
 if the configuration supplied overly long names for these fields.
 [ISC-Bugs #21497] Add a little more randomness to rng seed in client
This commit is contained in:
Shawn Routhier
2010-09-08 22:13:05 +00:00
parent ea75d5443c
commit 66be0ad13f
5 changed files with 58 additions and 16 deletions

View File

@@ -1084,10 +1084,13 @@ void dhcpinform (packet, ms_nulltp)
packet -> options, (struct option_state *)0,
&global_scope, oc, MDL)) {
i = d1.len;
if (i > sizeof raw.file)
i = sizeof raw.file;
else
raw.file [i] = 0;
if (i >= sizeof(raw.file)) {
log_info("file name longer than packet field "
"truncated - field: %d name: %d %.*s",
sizeof(raw.file), i, i, d1.data);
i = sizeof(raw.file);
} else
raw.file[i] = 0;
memcpy (raw.file, d1.data, i);
data_string_forget (&d1, MDL);
}
@@ -1100,10 +1103,13 @@ void dhcpinform (packet, ms_nulltp)
packet -> options, (struct option_state *)0,
&global_scope, oc, MDL)) {
i = d1.len;
if (i > sizeof raw.sname)
i = sizeof raw.sname;
else
raw.sname [i] = 0;
if (i >= sizeof(raw.sname)) {
log_info("server name longer than packet field "
"truncated - field: %d name: %d %.*s",
sizeof(raw.sname), i, i, d1.data);
i = sizeof(raw.sname);
} else
raw.sname[i] = 0;
memcpy (raw.sname, d1.data, i);
data_string_forget (&d1, MDL);
}
@@ -3010,6 +3016,11 @@ void dhcp_reply (lease)
if (sizeof raw.file > state -> filename.len)
memset (&raw.file [state -> filename.len], 0,
(sizeof raw.file) - state -> filename.len);
else
log_info("file name longer than packet field "
"truncated - field: %d name: %d %.*s",
sizeof(raw.file), state->filename.len,
state->filename.len, state->filename.data);
} else
bufs |= 1;
@@ -3023,6 +3034,12 @@ void dhcp_reply (lease)
if (sizeof raw.sname > state -> server_name.len)
memset (&raw.sname [state -> server_name.len], 0,
(sizeof raw.sname) - state -> server_name.len);
else
log_info("server name longer than packet field "
"truncated - field: %d name: %d %.*s",
sizeof(raw.sname), state->server_name.len,
state->server_name.len,
state->server_name.data);
} else
bufs |= 2; /* XXX */