@matheusbsbs / matheus-bagliano / commits / 8713feb16d
Fork 0

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 <johannes.schindelin@gmx.de> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Sep 29, 2010 at 23:22 UTC 8713feb16dd6a472828bbdcf914a1c8f5c6810a2
1 file changed +6 -2
connect.c
+6 -2
@@ -631,8 +631,12 @@ char *git_getpass(const char *prompt)
631 askpass = askpass_program;
632 if (!askpass)
633 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 + }
640
641 args[0] = askpass;
642 args[1] = prompt;