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

Fix the following clang warnings by reducing the scan size from 4096 to
4095 so that there is room for the null character.

api.c:5173:52: warning: 'fscanf' may overflow; destination buffer in
argument 4 has size 4096, but the corresponding specifier may require
size 4097 [-Wfortify-source]
 5173 |                         ret = fscanf(pid_cgrp_fd,
"%d::%4096s\n", &num, cgrp_path);
      |
^
api.c:5218:69: warning: 'fscanf' may overflow; destination buffer in
argument 5 has size 4096, but the corresponding specifier may require
size 4097 [-Wfortify-source]
 5218 |                 ret = fscanf(pid_cgrp_fd, "%d:%[^:]:%4096s\n",
&num, controllers, cgrp_path);
      |
^

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