r7516: make sure binary decoding gives us something we can run string functions on
authorAndrew Tridgell <tridge@samba.org>
Mon, 13 Jun 2005 05:56:46 +0000 (05:56 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:03 +0000 (13:18 -0500)
(This used to be commit 9913ab2550fae465c7a66fe7fa3a36a65b25b358)

source4/lib/ldb/common/ldb_parse.c

index 80841054c6fab46901f880ee6f6205cc634df54f..40e83f01bd623f725237f96b635290b167dc7d12 100644 (file)
@@ -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;
 }