mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-10-26 00:37:41 +03:00
Don't mutate dst_size
This lead to `dst_size` not having the intended value in subsequent code. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -116,9 +116,8 @@ void mbedtls_base64_decode(char *src_string, char *dst_string, int result)
|
|||||||
if (result == 0 && dst_size != 0) {
|
if (result == 0 && dst_size != 0) {
|
||||||
mbedtls_free(dst);
|
mbedtls_free(dst);
|
||||||
dst = NULL;
|
dst = NULL;
|
||||||
dst_size -= 1;
|
TEST_CALLOC(dst, dst_size - 1);
|
||||||
TEST_CALLOC(dst, dst_size);
|
TEST_EQUAL(mbedtls_base64_decode(dst, dst_size - 1, &len,
|
||||||
TEST_EQUAL(mbedtls_base64_decode(dst, dst_size, &len,
|
|
||||||
src, src_len),
|
src, src_len),
|
||||||
MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
|
MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
|
||||||
TEST_EQUAL(correct_dst_len, len);
|
TEST_EQUAL(correct_dst_len, len);
|
||||||
|
|||||||
Reference in New Issue
Block a user