From abdf738d1ff2b87722fb9bf4cfee2d03c6f8ba25 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sat, 27 Nov 2021 15:04:08 +0100 Subject: [PATCH] Socat might have crashed on peer cert without subject --- CHANGES | 4 ++++ xio-openssl.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index b04de7c..e138781 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@  Corrections: + Socat crashed with SIGSEGV when peer presented a certificate without + (or empty?) subject. + Thanks to Martin Dorey for reporting this issue and sending a patch. + Socat 1.7.4.2 did not compile on OmniOS (and probably other OpenSolaris distributions) Thanks to Andy Fiddaman for sending a patch. diff --git a/xio-openssl.c b/xio-openssl.c index dc47798..027b0d5 100644 --- a/xio-openssl.c +++ b/xio-openssl.c @@ -1539,7 +1539,7 @@ static int openssl_setenv_cert_name(const char *field, X509_NAME *name) { } memcpy(str, buf, len); str[len] = '\0'; - Info2("SSL peer cert %s: \"%s\"", field, buf); + Info2("SSL peer cert %s: \"%s\"", field, str); xiosetenv2("OPENSSL_X509", field, str, 1, NULL); free(str); BIO_free(bio);