linux/security/integrity/evm
Pengpeng Hou 11143a19f5 evm: terminate and bound the evm_xattrs read buffer
evm_read_xattrs() allocates size + 1 bytes, fills them from the list of
enabled xattrs, and then passes strlen(temp) to
simple_read_from_buffer(). When no configured xattrs are enabled, the
fill loop stores nothing and temp[0] remains uninitialized, so strlen()
reads beyond initialized memory.

Explicitly terminate the buffer after allocation, use snprintf() for
each formatted line, and pass the accumulated length, without risk of
truncation, to simple_read_from_buffer().

Fixes: fa516b66a1 ("EVM: Allow runtime modification of the set of verified xattrs")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2026-05-13 08:31:40 -04:00
..
evm_crypto.c EVM: add comment describing why ino field is still unsigned long 2026-03-17 15:38:49 +01:00
evm_main.c evm: Enforce signatures version 3 with new EVM policy 'bit 3' 2026-04-01 10:16:53 -04:00
evm_posix_acl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441 2019-06-05 17:37:17 +02:00
evm_secfs.c evm: terminate and bound the evm_xattrs read buffer 2026-05-13 08:31:40 -04:00
evm.h evm: Enforce signatures version 3 with new EVM policy 'bit 3' 2026-04-01 10:16:53 -04:00
Kconfig evm: Make it independent from 'integrity' LSM 2024-02-15 23:43:47 -05:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00