d2787b
From 099fcac6fecef6fc367d8fcae8442195f3f174db Mon Sep 17 00:00:00 2001
d2787b
From: nik-redhat <nladha@redhat.com>
d2787b
Date: Fri, 25 Sep 2020 18:19:39 +0530
d2787b
Subject: [PATCH 596/610] locks: null dereference
d2787b
d2787b
Added a null check before executing the strtok_r()
d2787b
to avoid null dereference in case of strdup() failure.
d2787b
d2787b
CID: 1407938
d2787b
>Updates: #1060
d2787b
d2787b
>Change-Id: Iec6e72ae8cb54f6d0a287615c43756325b2026ec
d2787b
>Signed-off-by: nik-redhat <nladha@redhat.com>
d2787b
d2787b
Upstream link: https://review.gluster.org/c/glusterfs/+/25045
d2787b
BUG: 1997447
d2787b
d2787b
Change-Id: I47e6e2402badaf4103607b4164f19142a99a2f71
d2787b
Signed-off-by: nik-redhat <nladha@redhat.com>
d2787b
Reviewed-on: https://code.engineering.redhat.com/gerrit/c/rhs-glusterfs/+/280065
d2787b
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d2787b
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
d2787b
---
d2787b
 xlators/features/locks/src/posix.c | 3 +++
d2787b
 1 file changed, 3 insertions(+)
d2787b
d2787b
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
d2787b
index d5effef..03c4907 100644
d2787b
--- a/xlators/features/locks/src/posix.c
d2787b
+++ b/xlators/features/locks/src/posix.c
d2787b
@@ -494,6 +494,9 @@ pl_inodelk_xattr_fill_multiple(dict_t *this, char *key, data_t *value,
d2787b
     char *save_ptr = NULL;
d2787b
 
d2787b
     tmp_key = gf_strdup(key);
d2787b
+    if (!tmp_key)
d2787b
+        return -1;
d2787b
+
d2787b
     strtok_r(tmp_key, ":", &save_ptr);
d2787b
     if (!*save_ptr) {
d2787b
         gf_msg(THIS->name, GF_LOG_ERROR, 0, EINVAL,
d2787b
-- 
d2787b
1.8.3.1
d2787b