Windows process: escape backslashes before quotes

This commit is contained in:
Semphris authored and Sam Lantinga committed 2024-09-13 22:15:56 -07:00
1 parent 90e01040c5
commit 3cf54675bb
2 files changed
+13

No files matched your search

+10
View File
@@ -95,6 +95,10 @@ static bool join_arguments(const char * const *args, char **args_out)
case '"':
len += 2;
break;
case '\\':
/* only escape backslashes that precede a double quote */
len += (*(a + 1) == '"' || *(a + 1) == '\0') ? 2 : 1;
break;
default:
len += 1;
break;
@@ -121,6 +125,12 @@ static bool join_arguments(const char * const *args, char **args_out)
result[i_out++] = '\\';
result[i_out++] = *a;
break;
case '\\':
result[i_out++] = *a;
if (*(a + 1) == '"' || *(a + 1) == '\0') {
result[i_out++] = *a;
}
break;
default:
result[i_out++] = *a;
break;