From 72a6d2db61f4bfc035bcfb56458e577bac79e683 Mon Sep 17 00:00:00 2001 From: xzl <771730766@qq.com> Date: Sat, 27 May 2017 17:36:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AE=A1=E7=AE=97sha256?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=B4=A9=E6=BA=83=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtmp/RtmpProtocol.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Rtmp/RtmpProtocol.cpp b/src/Rtmp/RtmpProtocol.cpp index 2defe6d3..8fbda69f 100644 --- a/src/Rtmp/RtmpProtocol.cpp +++ b/src/Rtmp/RtmpProtocol.cpp @@ -17,15 +17,15 @@ using namespace ZL::Util; #include static string openssl_HMACsha256(const void *key,unsigned int key_len, const void *data,unsigned int data_len){ - char out[48]; + std::shared_ptr out(new char[32],[](char *ptr){delete [] ptr;}); unsigned int out_len; HMAC_CTX ctx; HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, key, key_len, EVP_sha256(), NULL); HMAC_Update(&ctx, (unsigned char*)data, data_len); - HMAC_Final(&ctx, (unsigned char *)out, &out_len); + HMAC_Final(&ctx, (unsigned char *)out.get(), &out_len); HMAC_CTX_cleanup(&ctx); - return string(out,out_len); + return string(out.get(),out_len); } #endif //ENABLE_OPENSSL