From 65f500d65a0553716f92116953755180f9171ec1 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Jul 2010 17:40:44 +0200 Subject: [PATCH] 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 --- connect.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/connect.c b/connect.c index 02e738a014..d3e967fcd9 100644 --- a/connect.c +++ b/connect.c @@ -628,8 +628,12 @@ char *git_getpass(const char *prompt) askpass = getenv("GIT_ASKPASS"); - if (!askpass || !(*askpass)) - return getpass(prompt); + if (!askpass || !(*askpass)) { + char *result = getpass(prompt); + if (!result) + die_errno("Could not read password"); + return result; + } args[0] = askpass; args[1] = prompt; -- 2.11.4.GIT