]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api: Fix clang warning
authorTom Hromatka <tom.hromatka@oracle.com>
Tue, 29 Jul 2025 16:07:27 +0000 (16:07 +0000)
committerKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 1 Aug 2025 09:02:21 +0000 (14:32 +0530)
commitdc212c5a6c7ff4e4455968ea9ee4d3af03a2972d
treec599991945f4f51b98943a40d36a27ae63da3ef1
parent80f12b0429f87a0df3251b8ff8074fb3828519df
api: Fix clang warning

Fix the following warnings from clang by reducing the size passed to
strncat by 1 as recommended by clang.

api.c:3784:24: warning: the value of the size argument in 'strncat' is
too large, might lead to a buffer overflow [-Wstrncat-size]
 3784 |         strncat(path, d_name, sizeof(path) - strlen(path));
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
api.c:3784:24: note: change the argument to be the free space in the
destination buffer minus the terminating null byte
 3784 |         strncat(path, d_name, sizeof(path) - strlen(path));
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                               sizeof(path) - strlen(path) - 1

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
src/api.c