diff options
author | Jiffin Tony Thottan <jthottan@redhat.com> | 2018-01-17 18:03:11 +0530 |
---|---|---|
committer | jiffin tony Thottan <jthottan@redhat.com> | 2018-02-02 06:47:32 +0000 |
commit | 35e2168a3cd8fb226701b5d3bac4507924db4a36 (patch) | |
tree | e09f1f68e7817a27935a34f870493d025bdb9bb4 /xlators/features | |
parent | e9d98d0e02e1817e5939d87a0cad6a796bce32cf (diff) |
selinux-xlator : validate dict before calling dict_rename_key()
Upstream reference
>Change-Id: I71da3b64e5e8c82e8842e119b2b05da3e2ace550
>BUG: 1535772
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
>(cherry picked from commit bee06ccd7b80e3f5804f0c7c7c56936fed6d2b4e)
Change-Id: I71da3b64e5e8c82e8842e119b2b05da3e2ace550
BUG: 1533269
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/selinux/src/selinux.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xlators/features/selinux/src/selinux.c b/xlators/features/selinux/src/selinux.c index 1a4b39f253c..386bce1bc44 100644 --- a/xlators/features/selinux/src/selinux.c +++ b/xlators/features/selinux/src/selinux.c @@ -22,7 +22,7 @@ selinux_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int ret = 0; char *name = cookie; - if (op_errno == 0 && name && (!strcmp(name, SELINUX_GLUSTER_XATTR))) { + if (op_errno == 0 && dict && name && (!strcmp(name, SELINUX_GLUSTER_XATTR))) { ret = dict_rename_key (dict, SELINUX_GLUSTER_XATTR, SELINUX_XATTR); if (ret < 0) @@ -77,7 +77,7 @@ selinux_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int ret = 0; char *name = cookie; - if (op_errno == 0 && name && (!strcmp(name, SELINUX_GLUSTER_XATTR))) { + if (op_errno == 0 && dict && name && (!strcmp(name, SELINUX_GLUSTER_XATTR))) { ret = dict_rename_key (dict, SELINUX_GLUSTER_XATTR, SELINUX_XATTR); if (ret < 0) @@ -147,7 +147,7 @@ selinux_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, GF_VALIDATE_OR_GOTO ("selinux", priv, err); - if (!priv->selinux_enabled) + if (!priv->selinux_enabled && !dict) goto off; ret = dict_rename_key (dict, SELINUX_XATTR, SELINUX_GLUSTER_XATTR); @@ -189,7 +189,7 @@ selinux_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, GF_VALIDATE_OR_GOTO ("selinux", priv, err); - if (!priv->selinux_enabled) + if (!priv->selinux_enabled && !dict) goto off; ret = dict_rename_key (dict, SELINUX_XATTR, SELINUX_GLUSTER_XATTR); |