mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
don't use sizeof
This commit is contained in:
parent
7ef6c72fc0
commit
75d790137d
@ -716,10 +716,10 @@ namespace http {
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
std::string provided = req.headers.find("Authorization")->second;
|
std::string provided = req.headers.find("Authorization")->second;
|
||||||
std::string expected = user + ":" + pass;
|
std::string expected = user + ":" + pass;
|
||||||
size_t b64_sz = i2p::data::Base64EncodingBufferSize(expected.length());
|
size_t b64_sz = i2p::data::Base64EncodingBufferSize(expected.length()) + 1;
|
||||||
char * b64_creds = new char[b64_sz+1];
|
char * b64_creds = new char[b64_sz];
|
||||||
std::size_t len = 0;
|
std::size_t len = 0;
|
||||||
len = i2p::data::ByteStreamToBase64((unsigned char *)expected.c_str(), expected.length(), b64_creds, sizeof(b64_creds));
|
len = i2p::data::ByteStreamToBase64((unsigned char *)expected.c_str(), expected.length(), b64_creds, b64_sz);
|
||||||
/* if we decoded properly then check credentials */
|
/* if we decoded properly then check credentials */
|
||||||
if(len) {
|
if(len) {
|
||||||
b64_creds[len] = '\0';
|
b64_creds[len] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user