Fix buffer over-read in argsplit when trailing backslash occurs inside double quotes

This commit is contained in:
Andrea Mazzoleni 2026-08-18 22:36:07 +02:00
parent a89b6f3126
commit b4634578ba

View file

@ -115,7 +115,7 @@ unsigned argsplit(const char** split_map, unsigned split_max, char* str)
/* double-quoted block */
++str;
while (*str != 0 && *str != '"') {
if (*str == '\\' && strchr(dq_escapable, *(str + 1))) {
if (*str == '\\' && *(str + 1) != 0 && strchr(dq_escapable, *(str + 1))) {
++str;
}
*dst++ = *str++;