]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
eloop: Use size_t for signal_count
authorJouni Malinen <j@w1.fi>
Sun, 22 Mar 2020 16:15:43 +0000 (18:15 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 22 Mar 2020 16:50:04 +0000 (18:50 +0200)
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 <j@w1.fi>
src/utils/eloop.c
src/utils/eloop_win.c

index bb375be1095e6a95d9e9c808342fd4e34bf2806f..bcffeeb11e4e9b1e0df02ae569a64d17a51a3d63 100644 (file)
@@ -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;
index 9c8b12be8ad80d3146ec0836725e66a1d9e0b13d..74eaa33ece9a4d486a08ca115d3d1803d653974f 100644 (file)
@@ -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;
 }