fixup errbuf length in the other files and avoid using the static buffer in one place (for thread safety and code consistency reasons)

This commit is contained in:
Elias Ohm 2019-05-09 09:30:12 +02:00
parent e75f063552
commit 4c86c370bb
2 changed files with 4 additions and 3 deletions

View File

@ -61,7 +61,7 @@ TlsStream::TlsStream(const Socket::Ptr& socket, const String& hostname, Connecti
m_CurrentAction(TlsActionNone), m_Retry(false), m_Shutdown(false)
{
std::ostringstream msgbuf;
char errbuf[120];
char errbuf[256];
m_SSL = std::shared_ptr<SSL>(SSL_new(sslContext), SSL_free);
@ -272,8 +272,9 @@ void TlsStream::OnEvent(int revents)
m_ErrorOccurred = true;
if (m_ErrorCode != 0) {
char errbuf[256];
Log(LogWarning, "TlsStream")
<< "OpenSSL error: " << ERR_error_string(m_ErrorCode, nullptr);
<< "OpenSSL error: " << ERR_error_string(m_ErrorCode, errbuf);
} else {
Log(LogWarning, "TlsStream", "TLS stream was disconnected.");
}

View File

@ -53,7 +53,7 @@ int PkiUtility::NewCert(const String& cn, const String& keyfile, const String& c
int PkiUtility::SignCsr(const String& csrfile, const String& certfile)
{
char errbuf[120];
char errbuf[256];
InitializeOpenSSL();