diff options
author | Jiffin Tony Thottan <jthottan@redhat.com> | 2018-01-17 18:03:11 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-01-18 18:32:28 +0000 |
commit | bee06ccd7b80e3f5804f0c7c7c56936fed6d2b4e (patch) | |
tree | 351946332cce9e4728b30d05e1c83ca503caf852 | |
parent | 2db7872d5251d98d47c262ff269776bfae2d4fb9 (diff) |
selinux-xlator : validate dict before calling dict_rename_key()
Change-Id: I71da3b64e5e8c82e8842e119b2b05da3e2ace550
BUG: 1535772
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
-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 190f10b57d8..2dd70599a86 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); |