summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-12-15 21:28:08 +0100
committerJeremy Allison <jra@samba.org>2013-12-17 01:57:13 +0100
commit20efaf9ea74f6c5ed7554aab2a0e687ed5a2f717 (patch)
treefeff04932e2c99d462d216621b905508da7cd1c9 /source4/param
parentb067f1e35bd3e3fa886aae3b0011e1585664f11e (diff)
downloadsamba-20efaf9ea74f6c5ed7554aab2a0e687ed5a2f717.tar.gz
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>
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/share_ldb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c
index 212d910ae02..601ab042caf 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 {