[PATCH 2/4] pinentry-tty: fix segfault on MESSAGE or CONFIRM

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Apr 28 19:01:14 CEST 2015


* tty/pinentry-tty.c: avoid prompting for a PIN when one was not asked
  for.

--

Before this, pinentry-tty would segfault when asked for MESSAGE or
CONFIRM:

0 dkg at alice:~$ pinentry-tty
OK Your orders please
SETDESC testing testing
OK
MESSAGE
testing testing
PIN? :
Segmentation fault
139 dkg at alice:~$
---
 tty/pinentry-tty.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c
index 1aeffbd..e2e0871 100644
--- a/tty/pinentry-tty.c
+++ b/tty/pinentry-tty.c
@@ -168,7 +168,14 @@ tty_cmd_handler(pinentry_t pinentry)
 
   if (rc == 0)
     {
-      rc = read_password (pinentry, ttyfi, ttyfo);
+      if (pinentry->pin)
+        rc = read_password (pinentry, ttyfi, ttyfo);
+      else 
+        {
+          fprintf (ttyfo, "%s\n",
+                   pinentry->description? pinentry->description:"");
+          fflush (ttyfo);
+        }
       do_touch_file (pinentry);
     }
   
-- 
2.1.4




More information about the Gnupg-devel mailing list