Require explicit length in s3fs_decode64 (#1755)

This is available from std::string::size in callers.
This commit is contained in:
Andrew Gaul
2021-08-31 09:22:10 +09:00
committed by GitHub
parent d9f2d17040
commit 48817d849f
5 changed files with 12 additions and 13 deletions

View File

@ -432,16 +432,15 @@ inline unsigned char char_decode64(const char ch)
return by;
}
unsigned char* s3fs_decode64(const char* input, size_t* plength)
unsigned char* s3fs_decode64(const char* input, size_t input_len, size_t* plength)
{
unsigned char* result;
if(!input || 0 == strlen(input) || !plength){
if(!input || 0 == input_len || !plength){
return NULL;
}
result = new unsigned char[strlen(input) / 4 * 3];
result = new unsigned char[input_len / 4 * 3];
unsigned char parts[4];
size_t input_len = strlen(input);
size_t rpos;
size_t wpos;
for(rpos = 0, wpos = 0; rpos < input_len; rpos += 4){