1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-10-24 13:32:59 +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:
Gilles Peskine
2025-06-11 18:24:26 +02:00
parent 55d211388a
commit 03303d88fb

View File

@@ -116,9 +116,8 @@ void mbedtls_base64_decode(char *src_string, char *dst_string, int result)
if (result == 0 && dst_size != 0) {
mbedtls_free(dst);
dst = NULL;
dst_size -= 1;
TEST_CALLOC(dst, dst_size);
TEST_EQUAL(mbedtls_base64_decode(dst, dst_size, &len,
TEST_CALLOC(dst, dst_size - 1);
TEST_EQUAL(mbedtls_base64_decode(dst, dst_size - 1, &len,
src, src_len),
MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
TEST_EQUAL(correct_dst_len, len);