[Dnsmasq-discuss] dhcp_lease_time utility not working

Tomasz Szajner tszajner at gmail.com
Tue Aug 13 01:31:05 BST 2019


It looks like the dhcp_lease_time utility is not working anymore
(after I upgraded to version 2.80). I tracked it down to commit
2b38e382, in the file contrib/lease-tools/dhcp_lease_time.c (when I
revert the change in this file, the utility works as expected). My
guess is that the author forgot to reverse the "greater-than" symbol
when multiplying both sides of the equation by -1, although I'm not
sure what the intent of the change was.

diff --git a/contrib/lease-tools/dhcp_lease_time.c
index f9d7a85..697d627 100644
--- a/contrib/lease-tools/dhcp_lease_time.c
+++ b/contrib/lease-tools/dhcp_lease_time.c
@@ -83,7 +83,7 @@ static unsigned char *option_find1(unsigned char *p,
unsigned char *end, int opt
           if (p >= end - 2)
             return NULL; /* malformed packet */
           opt_len = option_len(p);
-          if (p >= end - (2 + opt_len))
+          if (end - p >= (2 + opt_len))
             return NULL; /* malformed packet */
           if (*p == opt && opt_len >= minsize)
             return p;

Appreciate any help.


More information about the Dnsmasq-discuss mailing list