From 8713feb16dd6a472828bbdcf914a1c8f5c6810a2 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 29 Sep 2010 23:22:32 +0100 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 Signed-off-by: Pat Thoyts Signed-off-by: Junio C Hamano --- connect.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/connect.c b/connect.c index 3450cabd0e..57dc20c43c 100644 --- a/connect.c +++ b/connect.c @@ -631,8 +631,12 @@ char *git_getpass(const char *prompt) askpass = askpass_program; if (!askpass) askpass = getenv("SSH_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