summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2020-01-21 10:16:29 +0200
committerSusant Palai <spalai@redhat.com>2020-02-05 04:52:28 +0000
commit2b35572e1f30c37bbbbec8f63060ae2eeaf61b32 (patch)
tree07dc148560e737eb93003943168b037bfb5fb1cd /xlators/cluster
parentc4b5cfbfa82de0aa16e9557f5b3fcf3dc186c740 (diff)
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 <ykaul@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-hashfn.c3
1 files changed, 3 insertions, 0 deletions
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);