diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2023-07-08 17:59:20 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2023-07-08 17:59:20 +0100 |
commit | aae2bf28db36ab9133829dc33ea6ef886e8373c2 (patch) | |
tree | 1e1b669d5d6381ddd9b5e21e7142847f66fffcc8 /src | |
parent | 00392be0e7cfb5c6c6ce173ff31d81ab2a2e8779 (diff) |
Fix json extract for strings carrying commas. Bug 3006
Diffstat (limited to 'src')
-rw-r--r-- | src/src/expand.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/src/expand.c b/src/src/expand.c index 55c53957e..fea6501fe 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -2384,19 +2384,26 @@ static uschar * json_nextinlist(const uschar ** list) { unsigned array_depth = 0, object_depth = 0; +BOOL quoted = FALSE; const uschar * s = *list, * item; skip_whitespace(&s); for (item = s; - *s && (*s != ',' || array_depth != 0 || object_depth != 0); + *s && (*s != ',' || array_depth != 0 || object_depth != 0 || quoted); s++) - switch (*s) + if (!quoted) switch (*s) { case '[': array_depth++; break; case ']': array_depth--; break; case '{': object_depth++; break; case '}': object_depth--; break; + case '"': quoted = TRUE; + } + else switch(*s) + { + case '\\': s++; break; /* backslash protects one char */ + case '"': quoted = FALSE; break; } *list = *s ? s+1 : s; if (item == s) return NULL; |