Ensure output of crypto_base64_decode is NULL terminated.
This commit is contained in:
parent
e45ebd871e
commit
dfa7ac6434
@ -124,7 +124,7 @@ static void* base64_decode(const char* s, int length, int* data_len)
|
||||
if (length % 4)
|
||||
return NULL;
|
||||
|
||||
q = data = (BYTE*) malloc(length / 4 * 3);
|
||||
q = data = (BYTE*) malloc(length / 4 * 3 + 1);
|
||||
if (!q)
|
||||
return NULL;
|
||||
|
||||
@ -184,6 +184,7 @@ static void* base64_decode(const char* s, int length, int* data_len)
|
||||
}
|
||||
|
||||
*data_len = outputLen;
|
||||
data[outputLen] = '\0';
|
||||
|
||||
return data;
|
||||
out_free:
|
||||
|
Loading…
Reference in New Issue
Block a user