From c83775d524612c24be97d3761a1cc29998040fa1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Sep 2010 18:01:21 -0700 Subject: ldb-dn: don't crash on NULL in ldb_binary_encode_string() Thanks to Nadya for finding this one! --- source4/lib/ldb/common/ldb_parse.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c index 746002e34a..0203f3299f 100644 --- a/source4/lib/ldb/common/ldb_parse.c +++ b/source4/lib/ldb/common/ldb_parse.c @@ -154,6 +154,9 @@ char *ldb_binary_encode(TALLOC_CTX *mem_ctx, struct ldb_val val) char *ldb_binary_encode_string(TALLOC_CTX *mem_ctx, const char *string) { struct ldb_val val; + if (string == NULL) { + return NULL; + } val.data = discard_const_p(uint8_t, string); val.length = strlen(string); return ldb_binary_encode(mem_ctx, val); -- cgit