diff options
author | Konstantin Khlebnikov <k.khlebnikov@samsung.com> | 2014-08-07 12:52:49 -0400 |
---|---|---|
committer | Casey Schaufler <casey@schaufler-ca.com> | 2014-08-08 17:51:19 -0400 |
commit | da1b63566c469bf3e2b24182114422e16b1aa34c (patch) | |
tree | 035aeda479dd9c497de381a21837c6167cf241c6 /security/smack | |
parent | b862e561bad6372872f5bf98d95f4131d265b110 (diff) |
Smack: remove unneeded NULL-termination from securtity label
Values of extended attributes are stored as binary blobs. NULL-termination
of them isn't required. It just wastes disk space and confuses command-line
tools like getfattr because they have to print that zero byte at the end.
This patch removes terminating zero byte from initial security label in
smack_inode_init_security and cuts it out in function smack_inode_getsecurity
which is used by syscall getxattr. This change seems completely safe, because
function smk_parse_smack ignores everything after first zero byte.
Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
Diffstat (limited to 'security/smack')
-rw-r--r-- | security/smack/smack_lsm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index afa5ad0e7f72..16ae8534b14c 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -672,7 +672,7 @@ static int smack_inode_init_security(struct inode *inode, struct inode *dir, | |||
672 | } | 672 | } |
673 | 673 | ||
674 | if (len) | 674 | if (len) |
675 | *len = strlen(isp) + 1; | 675 | *len = strlen(isp); |
676 | 676 | ||
677 | return 0; | 677 | return 0; |
678 | } | 678 | } |
@@ -1076,7 +1076,7 @@ static int smack_inode_getsecurity(const struct inode *inode, | |||
1076 | 1076 | ||
1077 | if (strcmp(name, XATTR_SMACK_SUFFIX) == 0) { | 1077 | if (strcmp(name, XATTR_SMACK_SUFFIX) == 0) { |
1078 | isp = smk_of_inode(inode); | 1078 | isp = smk_of_inode(inode); |
1079 | ilen = strlen(isp) + 1; | 1079 | ilen = strlen(isp); |
1080 | *buffer = isp; | 1080 | *buffer = isp; |
1081 | return ilen; | 1081 | return ilen; |
1082 | } | 1082 | } |
@@ -1101,7 +1101,7 @@ static int smack_inode_getsecurity(const struct inode *inode, | |||
1101 | else | 1101 | else |
1102 | return -EOPNOTSUPP; | 1102 | return -EOPNOTSUPP; |
1103 | 1103 | ||
1104 | ilen = strlen(isp) + 1; | 1104 | ilen = strlen(isp); |
1105 | if (rc == 0) { | 1105 | if (rc == 0) { |
1106 | *buffer = isp; | 1106 | *buffer = isp; |
1107 | rc = ilen; | 1107 | rc = ilen; |