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