Fix crash on exceeding DHCP lease limit.

This commit is contained in:
Simon Kelley
2013-04-11 14:07:02 +01:00
parent 81925ab73a
commit 0b0a73c1c9
2 changed files with 15 additions and 4 deletions

View File

@@ -58,6 +58,10 @@ version 2.66
Felker for the bug report.
Update Polish translation. Thanks to Jan Psota.
Fix crash if the configured DHCP lease limit is
reached. Regression occurred in 2.61. Thanks to Tsachi for
the bug report.
version 2.65

View File

@@ -703,8 +703,11 @@ static struct dhcp_lease *lease_allocate(void)
struct dhcp_lease *lease4_allocate(struct in_addr addr)
{
struct dhcp_lease *lease = lease_allocate();
lease->addr = addr;
lease->hwaddr_len = 256; /* illegal value */
if (lease)
{
lease->addr = addr;
lease->hwaddr_len = 256; /* illegal value */
}
return lease;
}
@@ -713,8 +716,12 @@ struct dhcp_lease *lease4_allocate(struct in_addr addr)
struct dhcp_lease *lease6_allocate(struct in6_addr *addrp, int lease_type)
{
struct dhcp_lease *lease = lease_allocate();
memcpy(lease->hwaddr, addrp, sizeof(*addrp)) ;
lease->flags |= lease_type;
if (lease)
{
memcpy(lease->hwaddr, addrp, sizeof(*addrp)) ;
lease->flags |= lease_type;
}
return lease;
}