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

Richard Mudgett (JIRA) noreply at issues.asterisk.org
Fri Jul 13 12:19:20 CDT 2012


     [ https://issues.asterisk.org/jira/browse/ASTERISK-20127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Mudgett updated ASTERISK-20127:
---------------------------------------

    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.


  was:
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...

@@ -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);

Reverting this change restores the correct functionality.



> [Regression] Config.c config_text_file_load() unescapes semicolons ("\;" -> ";") turning them into comments (corruption) on rewrite of a config file
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-20127
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20127
>             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