Skip to content

Commit 6ba872c

Browse files
authored
Merge pull request #317 from dscho/helper-selector-quoting
helper-selector: fix quoting of trailing backslashes
2 parents 112f6d6 + 4b732b9 commit 6ba872c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

git-extra/git-credential-helper-selector.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ static LPWSTR quote(LPWSTR string)
291291
while (end[1] == L'\\')
292292
end++;
293293
len += end - p;
294-
if (end[1] == L'"')
294+
if (end[1] == L'"' ||
295+
(needs_quotes && end[1] == L'\0'))
295296
len += end - p + 1;
296297
p = end;
297298
}
@@ -313,7 +314,7 @@ static LPWSTR quote(LPWSTR string)
313314
memcpy(q, p, (end - p) * sizeof(WCHAR));
314315
q += end - p;
315316
}
316-
if (end[1] == L'"') {
317+
if (end[1] == L'"' || end[1] == L'\0') {
317318
memcpy(q, p, (end - p + 1) * sizeof(WCHAR));
318319
q += end - p + 1;
319320
}

0 commit comments

Comments
 (0)