This commit fixes this warning in api.c:
api.c: In function ‘cgroup_read_stats_begin’:
api.c:4189:47: warning: ‘.stat’ directive output may be truncated
writing 5 bytes into a region of size between 0 and 4095
[-Wformat-truncation=]
4189 | snprintf(stat_file, sizeof(stat_file), "%s/%s.stat", stat_path,
| ^~~~~
api.c:4189:2: note: ‘snprintf’ output 7 or more bytes (assuming 4102)
into a destination of size 4096
4189 | snprintf(stat_file, sizeof(stat_file), "%s/%s.stat", stat_path,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4190 | controller);
| ~~~~~~~~~~~
Signed-off-by: Tom Hromatka <[email protected]>
---
src/api.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/api.c b/src/api.c
index 0a09e6fef67f..30555f124e74 100644
--- a/src/api.c
+++ b/src/api.c
@@ -4173,7 +4173,7 @@ int cgroup_read_stats_begin(const char *controller, const
char *path,
void **handle, struct cgroup_stat *cgroup_stat)
{
int ret = 0;
- char stat_file[FILENAME_MAX];
+ char stat_file[FILENAME_MAX + sizeof(".stat")];
char stat_path[FILENAME_MAX];
FILE *fp;
--
1.8.3.1
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel