mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-11 16:44:59 +00:00
07d6f1cea5
Clang complains: ibendport_record.c: In function ‘sepol_ibendport_get_ibdev_name’: ibendport_record.c:169:2: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation] 169 | strncpy(tmp_ibdev_name, ibendport->ibdev_name, IB_DEVICE_NAME_MAX); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ibendport_record.c: In function ‘sepol_ibendport_set_ibdev_name’: ibendport_record.c:189:2: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation] 189 | strncpy(tmp, ibdev_name, IB_DEVICE_NAME_MAX); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ strncpy(3) does not NUL-terminate the destination if the source is of the same length or longer then the specified size. The source of these copies are retrieved from sepol_ibendport_alloc_ibdev_name(), which allocates a fixed amount of IB_DEVICE_NAME_MAX bytes. Reduce the size to copy by 1 of all memory regions allocated by sepol_ibendport_alloc_ibdev_name(). Signed-off-by: Christian Göttsche <cgzones@googlemail.com> |
||
---|---|---|
.. | ||
cil | ||
include | ||
man | ||
src | ||
tests | ||
utils | ||
.gitignore | ||
COPYING | ||
Makefile | ||
VERSION |