aboutsummaryrefslogtreecommitdiffstats
path: root/main/strings.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-02 15:14:22 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-02 15:14:22 +0000
commit6cfe6e2588ee4a3c95151ff79205c51f3694b842 (patch)
treead1edf04117f8a9c8599ae643bd22aa3e9269585 /main/strings.c
parent3ee05f6e3f0917dcb7a60d89993f8004102285bc (diff)
Missed a common case for needing to extend the buffer.
(closes issue #14716) Reported by: sum Patches: 20090402__bug14716.diff.txt uploaded by tilghman (license 14) Tested by: sum git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186021 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/strings.c')
-rw-r--r--main/strings.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main/strings.c b/main/strings.c
index aecf4099e..2e4b749c9 100644
--- a/main/strings.c
+++ b/main/strings.c
@@ -143,7 +143,8 @@ char *__ast_str_helper2(struct ast_str **buf, size_t maxlen, const char *src, si
maxlen--;
(*buf)->__AST_STR_USED++;
- if (dynamic && (!maxlen || (escapecommas && !(maxlen - 1)))) {
+ if ((ptr >= (*buf)->__AST_STR_STR + (*buf)->__AST_STR_LEN - 3) ||
+ (dynamic && (!maxlen || (escapecommas && !(maxlen - 1))))) {
char *oldbase = (*buf)->__AST_STR_STR;
size_t old = (*buf)->__AST_STR_LEN;
if (ast_str_make_space(buf, (*buf)->__AST_STR_LEN * 2)) {