diff options
author | Volker Lendecke <vl@samba.org> | 2013-12-15 21:28:08 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-12-17 01:57:13 +0100 |
commit | 20efaf9ea74f6c5ed7554aab2a0e687ed5a2f717 (patch) | |
tree | feff04932e2c99d462d216621b905508da7cd1c9 | |
parent | b067f1e35bd3e3fa886aae3b0011e1585664f11e (diff) | |
download | samba-20efaf9ea74f6c5ed7554aab2a0e687ed5a2f717.tar.gz samba-20efaf9ea74f6c5ed7554aab2a0e687ed5a2f717.tar.xz samba-20efaf9ea74f6c5ed7554aab2a0e687ed5a2f717.zip |
share_ldb: Fix CID 1138336 Dereference null return value
False positive, but this way we avoid another strchr
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source4/param/share_ldb.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c index 212d910ae0..601ab042ca 100644 --- a/source4/param/share_ldb.c +++ b/source4/param/share_ldb.c @@ -123,21 +123,22 @@ static const char **sldb_string_list_option(TALLOC_CTX *mem_ctx, struct share_co struct ldb_message *msg; struct ldb_message_element *el; const char **list; + const char *colon; int i; if (scfg == NULL) return NULL; msg = talloc_get_type(scfg->opaque, struct ldb_message); - if (strchr(opt_name, ':')) { - char *name, *p; + colon = strchr(opt_name, ':'); + if (colon != NULL) { + char *name; name = talloc_strdup(scfg, opt_name); if (!name) { return NULL; } - p = strchr(name, ':'); - *p = '-'; + name[colon-opt_name] = '-'; el = ldb_msg_find_element(msg, name); } else { |