Skip to content
Snippets Groups Projects
Commit 3057660a authored by Russell Bryant's avatar Russell Bryant
Browse files

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: https://origsvn.digium.com/svn/asterisk/trunk@41944 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent ffd9281d
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment