From 20efaf9ea74f6c5ed7554aab2a0e687ed5a2f717 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 15 Dec 2013 21:28:08 +0100 Subject: share_ldb: Fix CID 1138336 Dereference null return value False positive, but this way we avoid another strchr Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source4/param/share_ldb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/param') 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 { -- cgit v1.2.1