Merge pull request #1115 from gaul/hash-length

Use length from s3fs_HMAC256 for consistency
This commit is contained in:
Takeshi Nakatani 2019-08-06 20:49:22 +09:00 committed by GitHub
commit 2e51a339a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2524,9 +2524,9 @@ string S3fsCurl::CalcSignature(const string& method, const string& canonical_uri
unsigned int cscope_len = StringToSign.size();
unsigned char* md = NULL;
unsigned int md_len = 0;
char hexSig[64 + 1];
s3fs_HMAC256(kSigning, kSigning_len, cscope, cscope_len, &md, &md_len);
char *hexSig = new char[2 * md_len + 1];
for(cnt = 0; cnt < md_len; cnt++){
sprintf(&hexSig[cnt * 2], "%02x", md[cnt]);
}
@ -2534,6 +2534,7 @@ string S3fsCurl::CalcSignature(const string& method, const string& canonical_uri
delete[] md;
Signature = hexSig;
delete[] hexSig;
return Signature;
}