From 5cd066df39f3636246694943fb8219ea668f3eee Mon Sep 17 00:00:00 2001 From: Brian West Date: Sun, 6 Jun 2010 23:26:09 -0500 Subject: [PATCH] fix issue reported on mailing list along with segfault. --- libs/esl/src/esl_event.c | 2 ++ src/switch_event.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index bdeffb82bd..5401e91f5c 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -76,6 +76,8 @@ static const char *EVENT_NAMES[] = { "CHANNEL_PARK", "CHANNEL_UNPARK", "CHANNEL_APPLICATION", + "CHANNEL_HOLD", + "CHANNEL_UNHOLD", "CHANNEL_ORIGINATE", "CHANNEL_UUID", "API", diff --git a/src/switch_event.c b/src/switch_event.c index 464cd00a8e..e572cf42fe 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -132,6 +132,8 @@ static char *EVENT_NAMES[] = { "CHANNEL_PARK", "CHANNEL_UNPARK", "CHANNEL_APPLICATION", + "CHANNEL_HOLD", + "CHANNEL_UNHOLD", "CHANNEL_ORIGINATE", "CHANNEL_UUID", "API", @@ -383,7 +385,7 @@ SWITCH_DECLARE(switch_status_t) switch_name_event(const char *name, switch_event switch_assert(RUNTIME_POOL != NULL); for (x = 0; x <= SWITCH_EVENT_ALL; x++) { - if ((strlen(name) > 13 && !strcasecmp(name + 13, EVENT_NAMES[x])) || !strcasecmp(name, EVENT_NAMES[x])) { + if ((strlen(name) > 13 && x < switch_arraylen(EVENT_NAMES) && !strcasecmp(name + 13, EVENT_NAMES[x])) || !strcasecmp(name, EVENT_NAMES[x])) { *type = x; return SWITCH_STATUS_SUCCESS; }