Skip to content

Commit 3575422

Browse files
committed
add quotes to empty strings
1 parent 822b756 commit 3575422

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

subprocess.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,8 @@ int subprocess_create_ex(const wchar_t *const commandLine[], int options,
668668
len++;
669669

670670
// Quote the argument if it has a space in it
671-
if (wcspbrk(commandLine[i], L"\t\v ") != SUBPROCESS_NULL)
671+
if (wcspbrk(commandLine[i], L"\t\v ") != SUBPROCESS_NULL ||
672+
commandLine[i][0] == SUBPROCESS_NULL)
672673
len += 2;
673674

674675
for (j = 0; L'\0' != commandLine[i][j]; j++) {
@@ -703,7 +704,8 @@ int subprocess_create_ex(const wchar_t *const commandLine[], int options,
703704
commandLineCombined[len++] = L' ';
704705
}
705706

706-
need_quoting = wcspbrk(commandLine[i], L"\t\v ") != SUBPROCESS_NULL;
707+
need_quoting = wcspbrk(commandLine[i], L"\t\v ") != SUBPROCESS_NULL ||
708+
commandLine[i][0] == SUBPROCESS_NULL;
707709
if (need_quoting) {
708710
commandLineCombined[len++] = L'"';
709711
}

0 commit comments

Comments
 (0)