[asterisk-commits] kmoore: branch 10 r354656 - in /branches/10: ./ main/config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 9 13:54:07 CST 2012


Author: kmoore
Date: Thu Feb  9 13:54:04 2012
New Revision: 354656

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=354656
Log:
Make the config parser remove escaping backslashes

The config parser in Asterisk does not currently remove a backslash that is
used to escape a semicolon which would otherwise be interpreted as the start
of a comment.

The change here causes that backslash to be removed, but does not create a
real escape system in the config parser.  The biggest complication with a real
escape system would be breaking existing configs everywhere (parsing \\ as \
and breaking on escaped non-semicolon characters) even though it would be the
"right" way to do things.

(closes issue ASTERISK-17121)
Review: https://reviewboard.asterisk.org/r/1724/
........

Merged revisions 354655 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/10/   (props changed)
    branches/10/main/config.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/main/config.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/config.c?view=diff&rev=354656&r1=354655&r2=354656
==============================================================================
--- branches/10/main/config.c (original)
+++ branches/10/main/config.c Thu Feb  9 13:54:04 2012
@@ -1534,7 +1534,9 @@
 				while ((comment_p = strchr(new_buf, COMMENT_META))) {
 					if ((comment_p > new_buf) && (*(comment_p - 1) == '\\')) {
 						/* Escaped semicolons aren't comments. */
-						new_buf = comment_p + 1;
+						new_buf = comment_p;
+						/* write over the \ and bring the null terminator with us */
+						memmove(comment_p - 1, comment_p, strlen(comment_p) + 1);
 					} else if (comment_p[1] == COMMENT_TAG && comment_p[2] == COMMENT_TAG && (comment_p[3] != '-')) {
 						/* Meta-Comment start detected ";--" */
 						if (comment < MAX_NESTED_COMMENTS) {




More information about the asterisk-commits mailing list