selinux/libsepol
Christian Göttsche 07d6f1cea5
libsepol: assure string NUL-termination of ibdev_name
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>
2021-07-13 21:01:11 +02:00
..
cil libsepol/cil: Improve checking for bad inheritance patterns 2021-07-07 12:29:15 -04:00
include libsepol: avoid implicit conversions 2021-07-13 21:01:07 +02:00
man selinux: Update manpages after removing legacy boolean and user code 2019-07-29 23:46:47 +02:00
src libsepol: assure string NUL-termination of ibdev_name 2021-07-13 21:01:11 +02:00
tests libsepol: silence -Wextra-semi-stmt warning 2021-07-06 11:08:11 -04:00
utils
.gitignore
COPYING
Makefile
VERSION Update VERSIONs to 3.2 for release. 2021-03-04 16:42:59 +01:00