From a5ad7a64c6a03e1cf085b21b84af5f2d3e00b947 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 10 Jul 2008 18:12:24 +0200 Subject: Fix a segfault in base64_encode_data_blob We did not allocate enough memory for the \0 and a = at the end (This used to be commit ea110de1dc6257b78631b7d83b7bbb728180c1a1) --- source3/lib/util_str.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 1e1108132c..7cb57adbb5 100644 --- a/source3/lib/util_str.c +++ b/source3/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); -- cgit