Fix copyright lines
[folly.git] / folly / io / async / ssl / SSLErrors.cpp
index ebc5d3d0fa456ac3bac115739375310b6a0e1ebe..4ea3a0411618dcac52e13df9a36b396b4cee0b3b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2016-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,8 +16,7 @@
 #include <folly/io/async/ssl/SSLErrors.h>
 
 #include <folly/Range.h>
-#include <openssl/err.h>
-#include <openssl/ssl.h>
+#include <folly/portability/OpenSSL.h>
 
 using namespace folly;
 
@@ -40,7 +39,8 @@ std::string decodeOpenSSLError(
   } else {
     std::array<char, 256> buf;
     ERR_error_string_n(errError, buf.data(), buf.size());
-    return std::string(buf.data(), buf.size());
+    // OpenSSL will null terminate the string.
+    return std::string(buf.data());
   }
 }
 
@@ -98,7 +98,7 @@ AsyncSocketException::AsyncSocketExceptionType exTypefromSSLErr(SSLError err) {
       return AsyncSocketException::SSL_ERROR;
   }
 }
-}
+} // namespace
 
 namespace folly {
 
@@ -127,4 +127,4 @@ SSLException::SSLException(SSLError error)
           getSSLErrorString(error).str(),
           0),
       sslError(error) {}
-}
+} // namespace folly