1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-05-28 21:50:02 +02:00

scd:openpgp: Fix a segv for cards supporting unknown curves.

* common/openpgp-oid.c (get_keyalgo_string): Do not strdup NULL.
--

Cherry pick 2.4/master commit of:
	385f484133

GnuPG-bug-id: 5963
This commit is contained in:
Werner Koch 2022-05-05 09:04:28 +02:00 committed by NIIBE Yutaka
parent ad2d578cba
commit 600e69b461
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -580,7 +580,7 @@ get_keyalgo_string (enum gcry_pk_algos algo,
for (i=0; i < keyalgo_strings_used; i++)
{
if (keyalgo_strings[i].algo == algo
&& keyalgo_strings[i].curve
&& keyalgo_strings[i].curve && curve
&& !strcmp (keyalgo_strings[i].curve, curve))
return keyalgo_strings[i].name;
}
@ -594,7 +594,7 @@ get_keyalgo_string (enum gcry_pk_algos algo,
else
name = xasprintf ("E_error");
nbits = 0;
curvebuf = xstrdup (curve);
curvebuf = curve? xstrdup (curve) : NULL;
}
else
{