summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-04 10:05:29 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-04 12:05:55 +0200
commit0416d1f94f36b703de46fa00e465b2bac24063ea (patch)
tree5c91dde644439853da0ab41eb247b93dc2ed7f01
parentf09c107685889fe1bfdfc83eba7d69877f356c5a (diff)
downloadgnutls-0416d1f94f36b703de46fa00e465b2bac24063ea.tar.gz
gnutls_pk_get_oid: return early on unknown algorithm
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--lib/algorithms/publickey.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/algorithms/publickey.c b/lib/algorithms/publickey.c
index 0bd8f0fbae..59d28af956 100644
--- a/lib/algorithms/publickey.c
+++ b/lib/algorithms/publickey.c
@@ -314,6 +314,9 @@ const char *gnutls_pk_get_oid(gnutls_pk_algorithm_t algorithm)
const char *ret = NULL;
const gnutls_pk_entry *p;
+ if (algorithm == 0)
+ return NULL;
+
for (p = pk_algorithms; p->name != NULL; p++)
if (p->id == algorithm) {
ret = p->oid;