From: William King Date: Sat, 25 May 2013 13:51:22 +0000 (-0700) Subject: This condition should NEVER be hit, but in case the started thread is unable to locat... X-Git-Tag: v1.2.13~327 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5ca2a00286718ab54729cc60066a6635429fc4e;p=thirdparty%2Ffreeswitch.git This condition should NEVER be hit, but in case the started thread is unable to locate itself in the EVENT_DISOATCH_QUEUE_THREADS array, it's best to return null here and kill the unexpected event thread rather than segfault FS by writing outside of the bounds of the EVENT_DISPATCH_QUEUE_RUNNING array. --- diff --git a/src/switch_event.c b/src/switch_event.c index e932a067d5..203a6d861d 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -26,7 +26,7 @@ * Anthony Minessale II * Michael Jerris * Paul D. Tinsley - * + * William King * * switch_event.c -- Event System * @@ -254,6 +254,10 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th } } + if ( my_id >= MAX_DISPATCH_VAL ) { + return NULL; + } + EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 1; switch_mutex_unlock(EVENT_QUEUE_MUTEX);