diff options
author | Kinsey Moore <kmoore@digium.com> | 2012-02-09 19:54:37 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2012-02-09 19:54:37 +0000 |
commit | 25e344168e9764cbba1af7b58d529cbe0f9ae01c (patch) | |
tree | 8395b15ab6b7dbe01752e432a9a3722997c68088 /main/config.c | |
parent | e5c51ee44c79950ff90660f29ae4b78ce8cc06d2 (diff) |
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
........
Merged revisions 354656 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354657 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/config.c')
-rw-r--r-- | main/config.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/main/config.c b/main/config.c index a527f2433..75aa4c7d7 100644 --- a/main/config.c +++ b/main/config.c @@ -1538,7 +1538,9 @@ static struct ast_config *config_text_file_load(const char *database, const char 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) { |