@@ -107,30 +107,30 @@ bool CMSGNotify_SMS::MSGNotify_SMS_SendTencent(LPCXSTR lpszAPIUrl, LPCXSTR lpszS
107107 }
108108
109109 __int64u m_nTime = time (NULL );
110- XCHAR tszTimeStr[20 ] = {};
110+ XCHAR tszTimeStr[32 ] = {};
111111 MSGNotify_SMS_UTCTime ((time_t )m_nTime, tszTimeStr);
112112 // ************* 拼接规范请求串 *************
113113 LPCXSTR lpszHTTPMethod = " POST" ;
114114 LPCXSTR lpszHTTPUri = " /" ;
115115 LPCXSTR lpszHTTPQuery = " " ;
116116
117117 XCHAR tszCanonicalHeaders[XPATH_MAX ] = {};
118- _xstprintf (tszCanonicalHeaders, _X (" content-type:application/json; charset=utf-8\n host:%s \n " ), st_APIDomain.tszFullDomain );
118+ _xstprintf (tszCanonicalHeaders, _X (" content-type:application/json; charset=utf-8\n host:%1023s \n " ), st_APIDomain.tszFullDomain );
119119 LPCXSTR lpszSignedHeaders = _X (" content-type;host" );
120120
121121 XCHAR tszHashPayload[XPATH_MIN ] = {};
122122 MSGNotify_SMS_Sha256Hex (m_StrHTTPBody.c_str (), tszHashPayload);
123123
124- XCHAR tszCanonicalRequest[XPATH_MID ] = {};
125- _xstprintf (tszCanonicalRequest, _X (" %s\n %s\n %s\n %s \n %s\n %s" ), lpszHTTPMethod, lpszHTTPUri, lpszHTTPQuery, tszCanonicalHeaders, lpszSignedHeaders, tszHashPayload);
124+ XCHAR tszCanonicalRequest[XPATH_MAX ] = {};
125+ _xstprintf (tszCanonicalRequest, _X (" %s\n %s\n %s\n %512s \n %s\n %s" ), lpszHTTPMethod, lpszHTTPUri, lpszHTTPQuery, tszCanonicalHeaders, lpszSignedHeaders, tszHashPayload);
126126 // ************* 拼接待签名字符串 *************
127127 LPCXSTR lpszAlgorithmStr = _X (" TC3-HMAC-SHA256" );
128128
129129 XCHAR tszCredentialScope[XPATH_MIN ] = {};
130- _xstprintf (tszCredentialScope, _X (" %s/%s /tc3_request" ), tszTimeStr, st_APIDomain.tszSubDomain );
130+ _xstprintf (tszCredentialScope, _X (" %s/%512s /tc3_request" ), tszTimeStr, st_APIDomain.tszSubDomain );
131131 XCHAR tszHashCanonicalRequest[XPATH_MIN ] = {};
132132 MSGNotify_SMS_Sha256Hex (tszCanonicalRequest, tszHashCanonicalRequest);
133- XCHAR tszString2Sign[XPATH_MID ] = {};
133+ XCHAR tszString2Sign[XPATH_MAX ] = {};
134134 _xstprintf (tszString2Sign, _X (" %s\n %lld\n %s\n %s" ), lpszAlgorithmStr, m_nTime, tszCredentialScope, tszHashCanonicalRequest);
135135 // ************* 计算签名 ***************
136136 XCHAR tszKeyStr[64 ] = {};
@@ -158,11 +158,11 @@ bool CMSGNotify_SMS::MSGNotify_SMS_SendTencent(LPCXSTR lpszAPIUrl, LPCXSTR lpszS
158158 XCHAR tszSignature[128 ] = {};
159159 BaseLib_String_HexToStr ((LPCXSTR )k_hmac_sha_sign, output_len, tszSignature, false );
160160 // ************* 拼接 Authorization *************
161- XCHAR tszAuthorization[XPATH_MID ] = {};
162- _xstprintf (tszAuthorization, _X (" %s Credential=%s/%s , SignedHeaders=%s, Signature=%s" ), lpszAlgorithmStr, lpszSecretID, tszCredentialScope, lpszSignedHeaders, tszSignature);
161+ XCHAR tszAuthorization[XPATH_MAX ] = {};
162+ _xstprintf (tszAuthorization, _X (" %s Credential=%s/%512s , SignedHeaders=%s, Signature=%s" ), lpszAlgorithmStr, lpszSecretID, tszCredentialScope, lpszSignedHeaders, tszSignature);
163163
164164 XCHAR tszHTTPHdr[XPATH_MAX ] = {};
165- _xstprintf (tszHTTPHdr, " Authorization: %s \r\n "
165+ _xstprintf (tszHTTPHdr, " Authorization: %512s \r\n "
166166 " Content-Type: application/json; charset=utf-8\r\n "
167167 " X-TC-Action: SendSms\r\n "
168168 " X-TC-Timestamp: %lld\r\n "
0 commit comments