Skip to content

Commit 8713feb

Browse files
dschogitster
authored andcommitted
Make sure that git_getpass() never returns NULL
The result of git_getpass() is used without checking for NULL, so let's just die() instead of returning NULL. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Pat Thoyts <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dbda967 commit 8713feb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

connect.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,12 @@ char *git_getpass(const char *prompt)
631631
askpass = askpass_program;
632632
if (!askpass)
633633
askpass = getenv("SSH_ASKPASS");
634-
if (!askpass || !(*askpass))
635-
return getpass(prompt);
634+
if (!askpass || !(*askpass)) {
635+
char *result = getpass(prompt);
636+
if (!result)
637+
die_errno("Could not read password");
638+
return result;
639+
}
636640

637641
args[0] = askpass;
638642
args[1] = prompt;

0 commit comments

Comments
 (0)