[asterisk-bugs] [JIRA] Created: (ASTERISK-20143) [Regression] Config.c config_text_file_load() unescapes semicolons ("\; " -> "; ") turning them into comments (corruption) on rewrite of a config file

Rusty Newton (JIRA) noreply at issues.asterisk.org
Tue Jul 17 17:48:21 CDT 2012


[Regression] Config.c config_text_file_load() unescapes semicolons ("\;" -> ";") turning them into comments (corruption) on rewrite of a config file
----------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: ASTERISK-20143
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20143
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Core/Configuration
    Affects Versions: 10.6.0
         Environment: Fedora 17 x86_64
            Reporter: George Joseph


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.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list