From 073b05bb85d4fe5f2ade631ab9e4d73f2df7df0f Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Sun, 13 Dec 2015 01:29:39 +0000 Subject: [PATCH] Reserve a few more bytes for base64 operations to prevent heap corruption --- libtransmission/crypto-utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libtransmission/crypto-utils.c b/libtransmission/crypto-utils.c index b850d1bb4..99279732f 100644 --- a/libtransmission/crypto-utils.c +++ b/libtransmission/crypto-utils.c @@ -208,7 +208,7 @@ tr_base64_encode (const void * input, ret_length += ret_length / 72 + 1; #endif - ret = tr_new (char, ret_length + 1); + ret = tr_new (char, ret_length + 8); base64_init_encodestate (&state); ret_length = base64_encode_block (input, input_length, ret, &state); @@ -256,7 +256,7 @@ tr_base64_decode (const void * input, size_t ret_length = input_length / 4 * 3; base64_decodestate state; - ret = tr_new (char, ret_length + 1); + ret = tr_new (char, ret_length + 8); base64_init_decodestate (&state); ret_length = base64_decode_block (input, input_length, ret, &state);