summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2022-05-05 09:04:28 +0200
committerWerner Koch <wk@gnupg.org>2022-05-05 09:38:32 +0200
commit385f4841330e277949ddf2f13939b97481d2d29c (patch)
treeb9fdab09b858372d92b560c4401148456207b412 /common
parentgpgscm: Fix handling an error for chdir. (diff)
downloadgnupg2-385f4841330e277949ddf2f13939b97481d2d29c.tar.xz
gnupg2-385f4841330e277949ddf2f13939b97481d2d29c.zip
scd:openpgp: Fix a segv for cards supporting unknown curves.
* common/openpgp-oid.c (get_keyalgo_string): Do not strdup NULL. -- GnuPG-bug-id: 5963
Diffstat (limited to 'common')
-rw-r--r--common/openpgp-oid.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/openpgp-oid.c b/common/openpgp-oid.c
index 0189407f8..f0460b068 100644
--- a/common/openpgp-oid.c
+++ b/common/openpgp-oid.c
@@ -658,7 +658,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;
}
@@ -672,7 +672,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
{