From 2b35572e1f30c37bbbbec8f63060ae2eeaf61b32 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Tue, 21 Jan 2020 10:16:29 +0200 Subject: dht-hashfn.c: ensure we do not try to calculate hash on NULL path For some reason, dht_selfheal_layout_alloc_start() sends a NULL loc->path string to dht_hash_compute(). Until we understand why it happens, we should strive not to crash on a strlen of a NULL pointer. Change-Id: I8c2a22602cfccba9af85f432a1841556f6978450 updates: bz#1793378 Signed-off-by: Yaniv Kaul --- xlators/cluster/dht/src/dht-hashfn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xlators/cluster/dht/src/dht-hashfn.c b/xlators/cluster/dht/src/dht-hashfn.c index 1dfe2a77907..acda67c312a 100644 --- a/xlators/cluster/dht/src/dht-hashfn.c +++ b/xlators/cluster/dht/src/dht-hashfn.c @@ -78,6 +78,9 @@ dht_hash_compute(xlator_t *this, int type, const char *name, uint32_t *hash_p) priv = this->private; + if (name == NULL) + return -1; + len = strlen(name) + 1; rsync_friendly_name = alloca(len); -- cgit