g10: When asking about a TOFU binding conflict, default to unknown.
authorNeal H. Walfield <neal@g10code.com>
Thu, 1 Sep 2016 12:31:31 +0000 (14:31 +0200)
committerNeal H. Walfield <neal@g10code.com>
Thu, 1 Sep 2016 12:31:31 +0000 (14:31 +0200)
* g10/tofu.c (ask_about_binding): Default to unknown.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
g10/tofu.c

index 2161cee..47c68fe 100644 (file)
@@ -1591,9 +1591,17 @@ ask_about_binding (ctrl_t ctrl,
       cpr_kill_prompt ();
       if (*response == CONTROL_L)
         tty_printf ("%s", prompt);
-      else if (strlen (response) == 1)
+      else if (!response[0])
+        /* Default to unknown.  Don't save it.  */
+        {
+          tty_printf (_("Defaulting to unknown."));
+          *policy = TOFU_POLICY_UNKNOWN;
+          break;
+        }
+      else if (!response[1])
         {
           char *choice = strchr (choices, *response);
+
           if (choice)
             {
               int c = ((size_t) choice - (size_t) choices) / 2;