ISC DHCP service may not start due dhcp lease file bigger than 2 GB
name: ISC DHCP service may not start due dhcp lease file bigger than 2 GB
about: Starting verificarion does not assume that lease file can be large than 2 GB
Describe the bug ISC DHCP verifies size of dhcpd.lease file when compiles with TRACING; There is predefined code to check that files is less than 0x7FFFFFFFUL
To Reproduce Steps to reproduce the behavior:
- DHCP 4.4.2
- configuration with large DHCP leases database which can grow above 2 GB limit
Some customers with large DHCP scopes covering e.g. 10/8 network space and large information coming from circuit-id, remote-id can have big DHCP lease file before regular cleanup (rewrite) happens
Involved file: dhcp-4.4.2\server\confpars.c
In code:
#if defined (TRACING)
flen = lseek (file, (off_t)0, SEEK_END);
if (flen < 0) {
boom:
log_fatal ("Can't lseek on %s: %m", filename);
}
if (lseek (file, (off_t)0, SEEK_SET) < 0)
goto boom;
/* Can't handle files greater than 2^31-1. */
*if (flen > 0x7FFFFFFFUL)*
* log_fatal ("%s: file is too long to buffer.", filename);*
ulen = flen;
/* Allocate a buffer that will be what's written to the tracefile,
and also will be what we parse from. */
tflen = strlen (filename);
dbuf = dmalloc (ulen + tflen + 1, MDL);
if (!dbuf)
log_fatal ("No memory for %s (%d bytes)",
filename, ulen);
Expected behavior On x64 operating system, size of DHCP lease file can be over 32 bit limit and should not be limited by hard-coded value
Environment: Same code is present in latest 4.4.2 release