From fc5b73a4b95c03c2c81b04ee8c819471b66de52d Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Sat, 10 Jun 2017 18:32:08 +0100 Subject: [PATCH] sbr/netsec.c: Report popped TLS error code, don't pop again. ERR_get_error() pops an error code so having tested that value it should also be the one that's reported in an error message, not another popped error code by calling ERR_get_error() again as this misleads as to the error's cause. --- sbr/netsec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbr/netsec.c b/sbr/netsec.c index dd75bfd5..ab05cf8e 100644 --- a/sbr/netsec.c +++ b/sbr/netsec.c @@ -1631,7 +1631,7 @@ netsec_negotiate_tls(netsec_context *nsc, char **errstr) if (BIO_get_ssl(nsc->ssl_io, &ssl) < 1) { netsec_err(errstr, "Certificate verification failed, but " "cannot retrieve SSL handle: %s", - ERR_error_string(ERR_get_error(), NULL)); + ERR_error_string(errcode, NULL)); } else { netsec_err(errstr, "Server certificate verification failed: %s", X509_verify_cert_error_string( @@ -1639,7 +1639,7 @@ netsec_negotiate_tls(netsec_context *nsc, char **errstr) } } else { netsec_err(errstr, "TLS negotiation failed: %s", - ERR_error_string(errcode, NULL)); + ERR_error_string(errcode, NULL)); } /* -- 2.56.0