]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
do not escape strings inside single quotes unless we can find a closing quote too
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 13 Sep 2011 21:50:05 +0000 (16:50 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 13 Sep 2011 21:50:05 +0000 (16:50 -0500)
src/switch_utils.c

index 50f1725f5ee2d3329888c52b01acfa81247cc530..1c49fb410411457dfff9ebf68d81f42f6b988efa 100644 (file)
@@ -1871,7 +1871,7 @@ static char *cleanup_separated_string(char *str, char delim)
                        }
                }
                if (!esc) {
-                       if (*ptr == '\'') {
+                       if (*ptr == '\'' && (inside_quotes || ((ptr+1) && strchr(ptr+1, '\'')))) {
                                if ((inside_quotes = (1 - inside_quotes))) {
                                        end = dest;
                                }
@@ -1934,7 +1934,7 @@ static unsigned int separate_string_char_delim(char *buf, char delim, char **arr
                        /* escaped characters are copied verbatim to the destination string */
                        if (*ptr == ESCAPE_META) {
                                ++ptr;
-                       } else if (*ptr == '\'') {
+                       } else if (*ptr == '\'' && (inside_quotes || ((ptr+1) && strchr(ptr+1, '\'')))) {
                                inside_quotes = (1 - inside_quotes);
                        } else if (*ptr == delim && !inside_quotes) {
                                *ptr = '\0';