Compile-time check on buffer sizes for leasefile parsing code.

This commit is contained in:
Simon Kelley
2016-07-22 21:37:59 +01:00
parent 6b1c464d6d
commit bf4e62c19e
4 changed files with 21 additions and 10 deletions

View File

@@ -65,7 +65,14 @@ void lease_init(time_t now)
}
/* client-id max length is 255 which is 255*2 digits + 254 colons
borrow DNS packet buffer which is always larger than 1000 bytes */
borrow DNS packet buffer which is always larger than 1000 bytes
Check various buffers are big enough for the code below */
#if (DHCP_BUFF_SZ < 255) || (MAXDNAME < 64) || (PACKETSZ+MAXDNAME+RRFIXEDSZ < 764)
# error Buffer size breakage in leasfile parsing.
#endif
if (leasestream)
while (fscanf(leasestream, "%255s %255s", daemon->dhcp_buff3, daemon->dhcp_buff2) == 2)
{