fixed a bug where we would look for a signal past the end of the
authorAndrew Tridgell <tridge@samba.org>
Fri, 18 Jul 2008 03:46:01 +0000 (13:46 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 18 Jul 2008 03:46:01 +0000 (13:46 +1000)
signal arrays

This could cause the events code to get into a loop chewing CPU

lib/events/events_signal.c

index 2f6d4993832354121b82dce1c4478c3031e3d6f8..128a9bc0d03930e835c2f959f4c52e61c9c17b1c 100644 (file)
@@ -46,15 +46,15 @@ struct sigcounter {
   the poor design of signals means that this table must be static global
 */
 static struct sig_state {
-       struct signal_event *sig_handlers[NUM_SIGNALS];
-       struct sigaction *oldact[NUM_SIGNALS];
-       struct sigcounter signal_count[NUM_SIGNALS];
+       struct signal_event *sig_handlers[NUM_SIGNALS+1];
+       struct sigaction *oldact[NUM_SIGNALS+1];
+       struct sigcounter signal_count[NUM_SIGNALS+1];
        struct sigcounter got_signal;
        int pipe_hack[2];
 #ifdef SA_SIGINFO
        /* with SA_SIGINFO we get quite a lot of info per signal */
-       siginfo_t *sig_info[NUM_SIGNALS];
-       struct sigcounter sig_blocked[NUM_SIGNALS];
+       siginfo_t *sig_info[NUM_SIGNALS+1];
+       struct sigcounter sig_blocked[NUM_SIGNALS+1];
 #endif
 } *sig_state;