diff options
-rw-r--r-- | lib/auth_cert.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/auth_cert.c b/lib/auth_cert.c index 614b6794be..1c60942ffc 100644 --- a/lib/auth_cert.c +++ b/lib/auth_cert.c @@ -1340,7 +1340,9 @@ static int _gnutls_server_find_cert_list_index(gnutls_session session, } - if (session->internals.server_cert_callback != NULL && cred->ncerts > 0) { /* use the callback to get certificate */ + if (session->internals.server_cert_callback != NULL && cred->ncerts > 0) { + /* use the callback to get certificate + */ gnutls_datum *my_certs = NULL; my_certs = @@ -1378,7 +1380,8 @@ static int _gnutls_server_find_cert_list_index(gnutls_session session, my_certs, my_certs_length); - index = ij_map[index]; + if (index != -1) + index = ij_map[index]; clear: gnutls_free(my_certs); |