git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
088a6f4
)
Fix a segfault in base64_encode_data_blob
author
Volker Lendecke
<vl@samba.org>
Thu, 10 Jul 2008 16:12:24 +0000
(18:12 +0200)
committer
Jeremy Allison
<jra@samba.org>
Thu, 10 Jul 2008 17:06:26 +0000
(10:06 -0700)
We did not allocate enough memory for the \0 and a = at the end
source/lib/util_str.c
patch
|
blob
|
history
diff --git
a/source/lib/util_str.c
b/source/lib/util_str.c
index 6310e2464d06e2209b4a6b9338b7351d5669e61b..6678c0c24de71e08079c7efd9f9e06dbfb5864bf 100644
(file)
--- a/
source/lib/util_str.c
+++ b/
source/lib/util_str.c
@@
-2345,7
+2345,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);