From: Volker Lendecke Date: Thu, 10 Jul 2008 16:12:24 +0000 (+0200) Subject: Fix a segfault in base64_encode_data_blob X-Git-Tag: samba-3.3.0pre1~591 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ea110de1dc6257b78631b7d83b7bbb728180c1a1;p=thirdparty%2Fsamba.git Fix a segfault in base64_encode_data_blob We did not allocate enough memory for the \0 and a = at the end --- diff --git a/source/lib/util_str.c b/source/lib/util_str.c index 1e1108132cd..7cb57adbb59 100644 --- a/source/lib/util_str.c +++ b/source/lib/util_str.c @@ -2347,7 +2347,9 @@ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data) out_cnt = 0; len = data.length; - output_len = data.length * 2; + output_len = data.length * 2 + 4; /* Account for closing bytes. 4 is + * random but should be enough for + * the = and \0 */ result = TALLOC_ARRAY(mem_ctx, char, output_len); /* get us plenty of space */ SMB_ASSERT(result != NULL);