[asterisk-commits] tilghman: trunk r186021 - /trunk/main/strings.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 2 10:14:45 CDT 2009


Author: tilghman
Date: Thu Apr  2 10:14:22 2009
New Revision: 186021

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=186021
Log:
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

Modified:
    trunk/main/strings.c

Modified: trunk/main/strings.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/strings.c?view=diff&rev=186021&r1=186020&r2=186021
==============================================================================
--- trunk/main/strings.c (original)
+++ trunk/main/strings.c Thu Apr  2 10:14:22 2009
@@ -143,7 +143,8 @@
 		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)) {




More information about the asterisk-commits mailing list