From 913220cbb881ea405b158ae2116fd769bc4f8f3e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 22 Mar 2020 18:15:43 +0200 Subject: [PATCH] eloop: Use size_t for signal_count This is more consistent with the other eloop registrations and avoids a theoretical integer overflow with 16-bit int (not that there would ever be more that 32767 signal handlers getting registered). Signed-off-by: Jouni Malinen --- src/utils/eloop.c | 6 +++--- src/utils/eloop_win.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils/eloop.c b/src/utils/eloop.c index bb375be10..bcffeeb11 100644 --- a/src/utils/eloop.c +++ b/src/utils/eloop.c @@ -104,7 +104,7 @@ struct eloop_data { struct dl_list timeout; - int signal_count; + size_t signal_count; struct eloop_signal *signals; int signaled; int pending_terminate; @@ -968,7 +968,7 @@ static void eloop_handle_alarm(int sig) static void eloop_handle_signal(int sig) { - int i; + size_t i; #ifndef CONFIG_NATIVE_WINDOWS if ((sig == SIGINT || sig == SIGTERM) && !eloop.pending_terminate) { @@ -992,7 +992,7 @@ static void eloop_handle_signal(int sig) static void eloop_process_pending_signals(void) { - int i; + size_t i; if (eloop.signaled == 0) return; diff --git a/src/utils/eloop_win.c b/src/utils/eloop_win.c index 9c8b12be8..74eaa33ec 100644 --- a/src/utils/eloop_win.c +++ b/src/utils/eloop_win.c @@ -54,7 +54,7 @@ struct eloop_data { struct dl_list timeout; - int signal_count; + size_t signal_count; struct eloop_signal *signals; int signaled; int pending_terminate; @@ -422,7 +422,7 @@ int eloop_replenish_timeout(unsigned int req_secs, unsigned int req_usecs, #if 0 static void eloop_handle_signal(int sig) { - int i; + size_t i; eloop.signaled++; for (i = 0; i < eloop.signal_count; i++) { @@ -437,7 +437,7 @@ static void eloop_handle_signal(int sig) static void eloop_process_pending_signals(void) { - int i; + size_t i; if (eloop.signaled == 0) return; @@ -517,7 +517,7 @@ int eloop_register_signal_terminate(eloop_signal_handler handler, eloop.term_signal.handler = handler; eloop.term_signal.user_data = user_data; - + return 0; }