Merge branch 'jk/sq-dequote-on-bogus-input'
Code to unquote single-quoted string (used in the parser for configuration files, etc.) did not diagnose bogus input correctly and produced bogus results instead. * jk/sq-dequote-on-bogus-input: sq_dequote: fix extra consumption of source string
This commit is contained in:
12
quote.c
12
quote.c
@ -118,9 +118,15 @@ static char *sq_dequote_step(char *arg, char **next)
|
||||
*next = NULL;
|
||||
return arg;
|
||||
case '\\':
|
||||
c = *++src;
|
||||
if (need_bs_quote(c) && *++src == '\'') {
|
||||
*dst++ = c;
|
||||
/*
|
||||
* Allow backslashed characters outside of
|
||||
* single-quotes only if they need escaping,
|
||||
* and only if we resume the single-quoted part
|
||||
* afterward.
|
||||
*/
|
||||
if (need_bs_quote(src[1]) && src[2] == '\'') {
|
||||
*dst++ = src[1];
|
||||
src += 2;
|
||||
continue;
|
||||
}
|
||||
/* Fallthrough */
|
||||
|
Reference in New Issue
Block a user