From 748d7fe9cb7d20192b4b7d826509127fa04f43fb Mon Sep 17 00:00:00 2001 From: nik-redhat Date: Fri, 25 Sep 2020 18:19:39 +0530 Subject: 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 --- xlators/features/locks/src/posix.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'xlators/features/locks/src/posix.c') diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index cda02dadc2c..cf0ae4c57dd 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) -- cgit