[asterisk-commits] rmudgett: branch 1.8 r411960 - /branches/1.8/main/config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 8 15:49:20 CDT 2014


Author: rmudgett
Date: Tue Apr  8 15:49:11 2014
New Revision: 411960

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411960
Log:
config: Fix CB_ADD_LEN() to work as originally intended.

Fix a long standing bug in CB_ADD_LEN() behaving like CB_ADD().

ASTERISK-23546 #close
Reported by: Walter Doekes

Modified:
    branches/1.8/main/config.c

Modified: branches/1.8/main/config.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/config.c?view=diff&rev=411960&r1=411959&r2=411960
==============================================================================
--- branches/1.8/main/config.c (original)
+++ branches/1.8/main/config.c Tue Apr  8 15:49:11 2014
@@ -122,8 +122,10 @@
 static void  CB_ADD_LEN(struct ast_str **cb, const char *str, int len)
 {
 	char *s = ast_alloca(len + 1);
-	ast_copy_string(s, str, len);
-	ast_str_append(cb, 0, "%s", str);
+
+	memcpy(s, str, len);
+	s[len] = '\0';
+	ast_str_append(cb, 0, "%s", s);
 }
 
 static void CB_RESET(struct ast_str *cb, struct ast_str *llb)  
@@ -1648,7 +1650,7 @@
 					} else if ((comment_p >= new_buf + 2) &&
 						   (*(comment_p - 1) == COMMENT_TAG) &&
 						   (*(comment_p - 2) == COMMENT_TAG)) {
-						/* Meta-Comment end detected */
+						/* Meta-Comment end detected "--;" */
 						comment--;
 						new_buf = comment_p + 1;
 						if (!comment) {




More information about the asterisk-commits mailing list