From 807f8a43a1939956a06b8a4fdb0666e1675da41b Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Wed, 12 Dec 2007 20:58:18 -0500 Subject: [PATCH] Return ASSUAN_Invalid_Value if no DISPLAY and TTYTYPE is set. Pinentry will segfault if no ttytype is set. --- src/pinentry.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pinentry.c b/src/pinentry.c index 3ecf37a7..c8d3e77b 100644 --- a/src/pinentry.c +++ b/src/pinentry.c @@ -206,9 +206,15 @@ static gpg_error_t launch_pinentry(struct pinentry_s *pin) argv[3] = NULL; if (!have_display) { - argv[3] = "--ttytype"; - argv[4] = pin->ttytype ? pin->ttytype : getenv("TERM"); - argv[5] = NULL; + gchar *p = getenv("TERM"); + + if (p) { + argv[3] = "--ttytype"; + argv[4] = pin->ttytype ? pin->ttytype : p; + argv[5] = NULL; + } + else + return _assuan_error(ASSUAN_Invalid_Value); } rc = assuan_pipe_connect(&ctx, pin->path ? pin->path : PINENTRY_PATH, -- 2.11.4.GIT