From 32597fb0788b6d8b1ee6d3698354624ddc72b7de Mon Sep 17 00:00:00 2001 From: seanbright Date: Sun, 25 Jan 2009 13:33:20 +0000 Subject: Resolve a logic error that was causing Page() to crash when more than one channel was specified. (closes issue #14308) Reported by: bluefox Patches: 20090124__bug14308.diff.txt uploaded by seanbright (license 71) Tested by: kc0bvu git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@170979 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_page.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'apps/app_page.c') diff --git a/apps/app_page.c b/apps/app_page.c index c94e1b11a..896b31b34 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -120,12 +120,15 @@ static int page_exec(struct ast_channel *chan, void *data) /* Count number of extensions in list by number of ampersands + 1 */ num_dials = 1; tmp2 = tmp; - while (*tmp2 && *tmp2++ == '&') { - num_dials++; + while (*tmp2) { + if (*tmp2 == '&') { + num_dials++; + } + tmp2++; } - if (!(dial_list = ast_calloc(num_dials, sizeof(void *)))) { - ast_log(LOG_ERROR, "Can't allocate %ld bytes for dial list\n", (long)(sizeof(void *) * num_dials)); + if (!(dial_list = ast_calloc(num_dials, sizeof(struct ast_dial *)))) { + ast_log(LOG_ERROR, "Can't allocate %ld bytes for dial list\n", (long)(sizeof(struct ast_dial *) * num_dials)); ast_module_user_remove(u); return -1; } -- cgit v1.2.3