From c0fc9a86c573fe4e68da95e55b910fad0efdfd7e Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Tue, 8 Dec 2020 12:38:35 +0100 Subject: [PATCH] Increase size of buffer for OpenSSL error messages According to man 3 ERR_error_string, "buf must be at least 256 bytes long", therefore increase the buffer size to 256 everywhere. --- lib/base/tlsutility.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp index ce2e459a0..bb048d04c 100644 --- a/lib/base/tlsutility.cpp +++ b/lib/base/tlsutility.cpp @@ -518,7 +518,7 @@ std::shared_ptr CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NAME String id = Utility::NewUniqueID(); - char errbuf[120]; + char errbuf[256]; SHA_CTX context; unsigned char digest[SHA_DIGEST_LENGTH]; @@ -592,7 +592,7 @@ String GetIcingaCADir() std::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject) { - char errbuf[120]; + char errbuf[256]; String cadir = GetIcingaCADir(); @@ -692,7 +692,7 @@ String PBKDF2_SHA256(const String& password, const String& salt, int iterations) String SHA1(const String& s, bool binary) { - char errbuf[120]; + char errbuf[256]; SHA_CTX context; unsigned char digest[SHA_DIGEST_LENGTH]; @@ -732,7 +732,7 @@ String SHA1(const String& s, bool binary) String SHA256(const String& s) { - char errbuf[120]; + char errbuf[256]; SHA256_CTX context; unsigned char digest[SHA256_DIGEST_LENGTH]; @@ -779,7 +779,7 @@ String RandomString(int length) if (!RAND_bytes(bytes, length)) { delete [] bytes; - char errbuf[120]; + char errbuf[256]; Log(LogCritical, "SSL") << "Error for RAND_bytes: " << ERR_peek_error() << ", \"" << ERR_error_string(ERR_peek_error(), errbuf) << "\"";