From acf9a72e3f78b62e34637c72f978fe6cdc614928 Mon Sep 17 00:00:00 2001 From: William King Date: Sat, 25 May 2013 06:51:22 -0700 Subject: [PATCH] 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. --- src/switch_event.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);