From 3b37867d2e2367bdcafd7ad07b42c996412e4e10 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 498feed7a..04ac0684f 100644 --- a/lib/base/tlsutility.cpp +++ b/lib/base/tlsutility.cpp @@ -506,7 +506,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]; @@ -580,7 +580,7 @@ String GetIcingaCADir() std::shared_ptr CreateCertIcingaCA(EVP_PKEY *pubkey, X509_NAME *subject) { - char errbuf[120]; + char errbuf[256]; String cadir = GetIcingaCADir(); @@ -680,7 +680,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]; @@ -720,7 +720,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]; @@ -767,7 +767,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) << "\"";