[asterisk-commits] russell: branch russell/ast_verbose_threadstorage r39031 - /team/russell/ast_...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Aug 5 12:17:53 MST 2006


Author: russell
Date: Sat Aug  5 14:17:52 2006
New Revision: 39031

URL: http://svn.digium.com/view/asterisk?rev=39031&view=rev
Log:
include the offset in the calculations for increasing the buffer size

Modified:
    team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h

Modified: team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h?rev=39031&r1=39030&r2=39031&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h (original)
+++ team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h Sat Aug  5 14:17:52 2006
@@ -296,15 +296,15 @@
 	/* Check to see if there was not enough space in the string buffer to prepare
 	 * the string.  Also, if a maximum length is present, make sure the current
 	 * length is less than the maximum before increasing the size. */
-	if ((res + 1) > (*buf)->len && (max_len ? ((*buf)->len < max_len) : 1)) {
+	if ((res + offset + 1) > (*buf)->len && (max_len ? ((*buf)->len < max_len) : 1)) {
 		/* Set the new size of the string buffer to be the size needed
 		 * to hold the resulting string (res) plus one byte for the
 		 * terminating '\0'.  If this size is greater than the max, set
 		 * the new length to be the maximum allowed. */
 		if (max_len)
-			(*buf)->len = ((res + 1) < max_len) ? (res + 1) : max_len;
+			(*buf)->len = ((res + offset + 1) < max_len) ? (res + offset + 1) : max_len;
 		else
-			(*buf)->len = res + 1;
+			(*buf)->len = res + offset + 1;
 
 		if (!(*buf = ast_realloc(*buf, (*buf)->len + sizeof(*(*buf)))))
 			return AST_DYNSTR_SET_FAILED;



More information about the asterisk-commits mailing list