summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-07-10 18:12:24 +0200
committerVolker Lendecke <vl@samba.org>2008-07-10 18:24:46 +0200
commita5ad7a64c6a03e1cf085b21b84af5f2d3e00b947 (patch)
tree611347c69c0b3b712ffd285636a35e6e23688838 /source3
parente8db7cac5048a26e07197fa85262ea639867ae19 (diff)
downloadsamba-a5ad7a64c6a03e1cf085b21b84af5f2d3e00b947.tar.gz
samba-a5ad7a64c6a03e1cf085b21b84af5f2d3e00b947.tar.bz2
samba-a5ad7a64c6a03e1cf085b21b84af5f2d3e00b947.zip
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)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_str.c4
1 files changed, 3 insertions, 1 deletions
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);