summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornik-redhat <nladha@redhat.com>2020-09-25 18:19:39 +0530
committerXavi Hernandez <xhernandez@redhat.com>2020-09-29 14:04:11 +0000
commit748d7fe9cb7d20192b4b7d826509127fa04f43fb (patch)
tree9a524dfc595b9e25aa6351754ff5774a7adc26a9
parenta0effc34aff418d6ecd4760c77587f5da25ca8cf (diff)
locks: null dereference
Added a null check before executing the strtok_r() to avoid null dereference in case of strdup() failure. CID: 1407938 Updates: #1060 Change-Id: Iec6e72ae8cb54f6d0a287615c43756325b2026ec Signed-off-by: nik-redhat <nladha@redhat.com>
-rw-r--r--xlators/features/locks/src/posix.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index cda02da..cf0ae4c 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -494,6 +494,9 @@ pl_inodelk_xattr_fill_multiple(dict_t *this, char *key, data_t *value,
char *save_ptr = NULL;
tmp_key = gf_strdup(key);
+ if (!tmp_key)
+ return -1;
+
strtok_r(tmp_key, ":", &save_ptr);
if (!*save_ptr) {
if (tmp_key)