Smack: remove unneeded NULL-termination from securtity label
authorKonstantin Khlebnikov <k.khlebnikov@samsung.com>
Thu, 7 Aug 2014 16:52:49 +0000 (20:52 +0400)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 1 Jan 2018 20:50:55 +0000 (20:50 +0000)
commit2db75fd326ba4cda7bc0db5a9eb7c4ea8db25cf2
tree0bf4eab6d5a5c1733afc45a653df6cc81fc36b9f
parent2dd8d5457df52372053f01c93fe374305796e58f
Smack: remove unneeded NULL-termination from securtity label

commit da1b63566c469bf3e2b24182114422e16b1aa34c upstream.

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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
security/smack/smack_lsm.c