From: Martin Schwenke Date: Wed, 29 May 2019 07:38:03 +0000 (+1000) Subject: ctdb-cluster: CID 1435726: NULL pointer dereference X-Git-Tag: ldb-2.0.5~466 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aa602a8cc590dd416764d21147545bb411e47e35;p=thirdparty%2Fsamba.git ctdb-cluster: CID 1435726: NULL pointer dereference Also found by csbuild. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/cluster/cluster_conf.c b/ctdb/cluster/cluster_conf.c index 540732d5b91..be79d5942a8 100644 --- a/ctdb/cluster/cluster_conf.c +++ b/ctdb/cluster/cluster_conf.c @@ -38,13 +38,24 @@ static bool check_static_string_change(const char *key, enum conf_update_mode mode) { if (mode == CONF_MODE_RELOAD) { - if (strcmp(old_value, new_value) != 0) { + if (old_value == new_value) { + goto done; + } + + /* + * At this point old_value or new_value can not both + * NULL, so if one is NULL then they are different + */ + if (old_value == NULL || + new_value == NULL || + strcmp(old_value, new_value) != 0) { D_WARNING("Ignoring update of [%s] -> %s\n", CLUSTER_CONF_SECTION, key); } } +done: return true; }