Discussion:
[PATCH] gdhcp: Remove unnecessary operation on lease seconds
(too old to reply)
Patrik Flykt
2015-10-08 13:39:41 UTC
Permalink
Lease seconds will not overflow, they are specified as a delta from
now to a point in the future. Therefore no truncation of the
received value is necessary.
---
gdhcp/client.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index 3c11957..f9cba89 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -1625,8 +1625,7 @@ static uint32_t get_lease(struct dhcp_packet *packet)
return 3600;

lease_seconds = get_be32(option);
- /* paranoia: must not be prone to overflows */
- lease_seconds &= 0x0fffffff;
+
if (lease_seconds < 10)
lease_seconds = 10;
--
2.1.4
Patrik Flykt
2015-10-19 10:02:53 UTC
Permalink
Post by Patrik Flykt
Lease seconds will not overflow, they are specified as a delta from
now to a point in the future. Therefore no truncation of the
received value is necessary.
Applied.

Patrik

Loading...