Skip to content

Commit

Permalink
Properly unescape multiple backslash sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavlo Lavrenenko authored and pjstevns committed Sep 21, 2013
1 parent 66c6c1f commit ffde9c8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/dm_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,16 @@ void p_string_unescape(T S)
{
char *s = S->str;
char *head = s, *this = s, *next = s;
char found_escape = 0;
while (*this) {
next = this+1;
if (*this && *next && (*this == '\\') && (*next == '"' || *next == '\\')) {
if (!found_escape && *this && *next && (*this == '\\') && (*next == '"' || *next == '\\')) {
found_escape = 1;
S->used--;
this++;
continue;
}
found_escape = 0;
*head++ = *this++;
}
*head = 0;
Expand Down

0 comments on commit ffde9c8

Please sign in to comment.