[Home]

Summary:ASTERISK-20127: [Regression] Config.c config_text_file_load() unescapes semicolons ("\;" -> ";") turning them into comments (corruption) on rewrite of a config file
Reporter:George Joseph (gjoseph)Labels:
Date Opened:2012-07-12 22:32:36Date Closed:2014-11-19 14:09:57.000-0600
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Core/Configuration
Versions:10.6.0 Frequency of
Occurrence
Constant
Related
Issues:
is caused byASTERISK-17121 Problems with Escaping Characters on SIP Calls in Dial() and Transfer() Applications
Environment:Fedora 17 x86_64Attachments:
Description:My customers who use Asterisk GUI have been complaining that their extensions.conf files are becoming corrupted on configuration saves.

Lines such as
PAGING_HEADER = Call-Info: \;answer-after=0
are being rewritten as
PAGING_HEADER = Call-Info:  ;answer-after=0

On re-read, everything after the now-unescaped semicolon is read as a comment with the result that the file is effectively corrupted (hence severity Major).  

This appears to have been broken with v354657 of config.c (which was an attempt to fix issue ASTERISK-17121).  I'm not sure what the commit author's intent was but here's the fragment from main/config.c that caused the issue...

{noformat}
@@ -1522,23 +1650,25 @@
<snip>
                                               /* 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);
{noformat}

Reverting this change restores the correct functionality.
Comments:By: George Joseph (gjoseph) 2014-11-19 14:09:58.029-0600

Committed in revision 427331