[git commit] udhcpc: make sure we do not overflow poll timeout

Denys Vlasenko vda.linux at googlemail.com
Fri Feb 17 18:20:32 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=7c67f1e9abf8bc26868236bbe3aa35aa130e2696
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/udhcp/d6_dhcpc.c | 2 +-
 networking/udhcp/dhcpc.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 067d351..bea589d 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -1085,7 +1085,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
 		if (tv > 0) {
 			log1("waiting on select %u seconds", tv);
 			timestamp_before_wait = (unsigned)monotonic_sec();
-			retval = poll(pfds, 2, tv * 1000);
+			retval = poll(pfds, 2, tv < INT_MAX/1000 ? tv * 1000 : INT_MAX);
 			if (retval < 0) {
 				/* EINTR? A signal was caught, don't panic */
 				if (errno == EINTR) {
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 8f7f59e..881512c 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1453,7 +1453,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
 		if (tv > 0) {
 			log1("waiting on select %u seconds", tv);
 			timestamp_before_wait = (unsigned)monotonic_sec();
-			retval = poll(pfds, 2, tv * 1000);
+			retval = poll(pfds, 2, tv < INT_MAX/1000 ? tv * 1000 : INT_MAX);
 			if (retval < 0) {
 				/* EINTR? A signal was caught, don't panic */
 				if (errno == EINTR) {


More information about the busybox-cvs mailing list