diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-03 22:56:01 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-03 22:56:01 +0000 |
commit | 340c6f047bf3406eea630aaf8d00f4dec0f5a016 (patch) | |
tree | 458dea97b3eccedb9a2547c50809cad4901d0c2a /main/utils.c | |
parent | 2dfdcd3b538e2aef94be73245ba1504de32e103c (diff) |
when calling this function to append to a dynamic string and the buffer was not
large enough and had to be reallocated, cut off the partially appended data.
Otherwise, the function will get called over and over again appending to the
end every time and never thinking it has enough room.
Thanks to jmls for access to his machine for debugging!
(issue #7691)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41944 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/utils.c')
-rw-r--r-- | main/utils.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c index feb4a621f..3a8e85f06 100644 --- a/main/utils.c +++ b/main/utils.c @@ -1219,6 +1219,9 @@ int ast_dynamic_str_thread_build_va(struct ast_dynamic_str **buf, size_t max_len if (!(*buf = ast_realloc(*buf, (*buf)->len + sizeof(*(*buf))))) return AST_DYNSTR_BUILD_FAILED; + if (append) + (*buf)->str[offset] = '\0'; + if (ts) pthread_setspecific(ts->key, *buf); |