From b4b99c410d742b09ec11c97b359d7e69eafcf7d8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 13 Sep 2011 16:50:05 -0500 Subject: [PATCH] do not escape strings inside single quotes unless we can find a closing quote too --- src/switch_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index 50f1725f5e..1c49fb4104 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -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';