g10: Fix segfault on unsupported curve.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 26 Jan 2016 02:12:33 +0000 (11:12 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 26 Jan 2016 02:12:33 +0000 (11:12 +0900)
* g10/call-agent.c (learn_status_cb): Don't use NULL for strcmp.
--

With libgcrypt not supporting cv25519, gpg segfaults.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
g10/call-agent.c

index 1d7ff57..d9e4859 100644 (file)
@@ -701,14 +701,10 @@ learn_status_cb (void *opaque, const char *line)
         {
           const char *curve;
 
-          i = 0;
-          do
-            {
-              curve = openpgp_enum_curves (&i);
-              if (!strcmp (curve, line+n))
-                break;
-            }
-          while (curve != NULL);
+          for (i = 0; (curve = openpgp_enum_curves (&i));)
+            if (!strcmp (curve, line+n))
+              break;
+
           parm->key_attr[keyno].curve = curve;
         }
     }