diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-05-11 22:48:20 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-05-11 22:48:20 +0000 |
commit | d2dd860b2d8d477c8bad9c0f46551fb7faf72527 (patch) | |
tree | 5fa59d9f528ed9834c23746a17d45dbeb4bc0302 /apps/app_voicemail.c | |
parent | cd5e530a82e471b2bcfde250de1cdea5d9d492ec (diff) |
Move 300 bytes around on the stack, to make more room for an extension buffer.
This allows more concurrent extensions to be copied for a single voicemail,
without creating a possibility of upsetting existing users, where a dialplan
could run out of stack space where it had run fine before. Alternatively,
we could have allocated off the heap, but that is a larger change and would
have increased the chance for instability introduced by this change.
This is really solved starting in 1.6.0.11, as the use of an ast_str buffer
allows an unlimited number of extensions (up to available memory). We
additionally create a new warning message when the buffer length is exceeded,
permitting administrators to see an issue after the fact, whereas previously
the list was silently truncated.
(closes issue #14739)
Reported by: p_lindheimer
Patches:
20090417__bug14739.diff.txt uploaded by tilghman (license 14)
Tested by: p_lindheimer
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@193755 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r-- | apps/app_voicemail.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 4646e9e53..a1cdf386f 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3965,7 +3965,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ char txtfile[PATH_MAX], tmptxtfile[PATH_MAX]; char callerid[256]; FILE *txt; - char date[256]; + char date[50]; int txtdes; int res = 0; int msgnum; @@ -3978,15 +3978,18 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ char fn[PATH_MAX]; char prefile[PATH_MAX] = ""; char tempfile[PATH_MAX] = ""; - char ext_context[256] = ""; + char ext_context[AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2] = ""; char fmt[80]; char *context; char ecodes[16] = "#"; - char tmp[1024] = "", *tmpptr; + char tmp[1324] = "", *tmpptr; struct ast_vm_user *vmu; struct ast_vm_user svm; const char *category = NULL; + if (strlen(ext) > sizeof(tmp) - 1) { + ast_log(LOG_WARNING, "List of extensions is too long (>%ld). Truncating.\n", (long) sizeof(tmp) - 1); + } ast_copy_string(tmp, ext, sizeof(tmp)); ext = tmp; context = strchr(tmp, '@'); |