summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-28 18:01:21 -0700
committerAndrew Tridgell <tridge@samba.org>2010-09-28 19:25:51 -0700
commitc83775d524612c24be97d3761a1cc29998040fa1 (patch)
treec65bb11c5836f494c881f35f64b0002e978fba05
parent3d4576b170d92f97018076faf0ed914cf2fdd01b (diff)
downloadsamba-c83775d524612c24be97d3761a1cc29998040fa1.tar.gz
samba-c83775d524612c24be97d3761a1cc29998040fa1.tar.bz2
samba-c83775d524612c24be97d3761a1cc29998040fa1.zip
ldb-dn: don't crash on NULL in ldb_binary_encode_string()
Thanks to Nadya for finding this one!
-rw-r--r--source4/lib/ldb/common/ldb_parse.c3
1 files changed, 3 insertions, 0 deletions
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);