Avoid implicitly dropping const modifier
authorAndre Pinto <aap@fb.com>
Wed, 8 Nov 2017 16:30:36 +0000 (08:30 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 8 Nov 2017 16:40:03 +0000 (08:40 -0800)
Summary: Use const_cast instead of implicitly dropping const modifier.

Reviewed By: reanimus

Differential Revision: D6269200

fbshipit-source-id: 61e1708c88a4139d3fdd9cf89f4ff778d0354bb2

folly/ssl/OpenSSLCertUtils.cpp

index f739763..9b9efa3 100644 (file)
@@ -199,7 +199,8 @@ std::unique_ptr<IOBuf> OpenSSLCertUtils::derEncode(X509& x509) {
 
 std::vector<X509UniquePtr> OpenSSLCertUtils::readCertsFromBuffer(
     ByteRange range) {
-  BioUniquePtr b(BIO_new_mem_buf(range.data(), range.size()));
+  BioUniquePtr b(
+      BIO_new_mem_buf(const_cast<unsigned char*>(range.data()), range.size()));
   if (!b) {
     throw std::runtime_error("failed to create BIO");
   }