Ensure output of crypto_base64_decode is NULL terminated.

This commit is contained in:
Armin Novak 2015-08-27 09:27:23 +02:00
parent e45ebd871e
commit dfa7ac6434

View File

@ -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: