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