]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix issue reported on mailing list along with segfault.
authorBrian West <brian@freeswitch.org>
Mon, 7 Jun 2010 04:26:09 +0000 (23:26 -0500)
committerBrian West <brian@freeswitch.org>
Mon, 7 Jun 2010 04:26:09 +0000 (23:26 -0500)
libs/esl/src/esl_event.c
src/switch_event.c

index bdeffb82bd7aae77fde3ab2b3d7b70e3fffcbe12..5401e91f5cb3c3f9f5c79f844aff6941fdb4d17d 100644 (file)
@@ -76,6 +76,8 @@ static const char *EVENT_NAMES[] = {
        "CHANNEL_PARK",
        "CHANNEL_UNPARK",
        "CHANNEL_APPLICATION",
+       "CHANNEL_HOLD",
+       "CHANNEL_UNHOLD",
        "CHANNEL_ORIGINATE",
        "CHANNEL_UUID",
        "API",
index 464cd00a8e17b425cdb850654774ec9e3796c339..e572cf42fe7aeee0864cd96a0a71a8a3c5fe7da7 100644 (file)
@@ -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;
                }