From e1fa7352ca0c27516f61e85ddf38477a70f12331 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Jun 2005 05:56:46 +0000 Subject: r7516: make sure binary decoding gives us something we can run string functions on (This used to be commit 9913ab2550fae465c7a66fe7fa3a36a65b25b358) --- source4/lib/ldb/common/ldb_parse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c index 80841054c6..40e83f01bd 100644 --- a/source4/lib/ldb/common/ldb_parse.c +++ b/source4/lib/ldb/common/ldb_parse.c @@ -136,7 +136,7 @@ struct ldb_val ldb_binary_decode(TALLOC_CTX *ctx, const char *str) struct ldb_val ret; int slen = strlen(str); - ret.data = talloc_size(ctx, slen); + ret.data = talloc_size(ctx, slen+1); ret.length = 0; if (ret.data == NULL) return ret; @@ -155,6 +155,7 @@ struct ldb_val ldb_binary_decode(TALLOC_CTX *ctx, const char *str) } } ret.length = j; + ((uint8_t *)ret.data)[j] = 0; return ret; } -- cgit