From 75ed80359179e09213b54c9b9ae89310a51ebdf4 Mon Sep 17 00:00:00 2001 From: Subodh Iyengar Date: Wed, 11 May 2016 00:14:01 -0700 Subject: [PATCH] Make error size more explicit Summary: We shouldn't rely on the internal buffer size of openssl for errors. This makes it more explicit. Reviewed By: knekritz Differential Revision: D3285918 fbshipit-source-id: 452bf16a3de151d0aa79c774f2fdfc1e08ee6f9c --- folly/io/async/ssl/SSLErrors.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/folly/io/async/ssl/SSLErrors.cpp b/folly/io/async/ssl/SSLErrors.cpp index c34e8bbd..ebc5d3d0 100644 --- a/folly/io/async/ssl/SSLErrors.cpp +++ b/folly/io/async/ssl/SSLErrors.cpp @@ -39,8 +39,8 @@ std::string decodeOpenSSLError( return "SSL connection closed normally"; } else { std::array buf; - std::string msg(ERR_error_string(errError, buf.data())); - return msg; + ERR_error_string_n(errError, buf.data(), buf.size()); + return std::string(buf.data(), buf.size()); } } -- 2.34.1