aboutsummaryrefslogtreecommitdiffstats
path: root/src/firemon
diff options
context:
space:
mode:
authorLibravatar Reiner Herrmann <reiner@reiner-h.de>2017-08-29 19:05:45 +0200
committerLibravatar Reiner Herrmann <reiner@reiner-h.de>2017-08-29 19:10:27 +0200
commitd6b542c89e1ba8ca407285c3c1715077d230581f (patch)
tree127dc8a700f71d37394d620baedddec81a36ea83 /src/firemon
parentFix pointer dereference (diff)
downloadfirejail-d6b542c89e1ba8ca407285c3c1715077d230581f.tar.gz
firejail-d6b542c89e1ba8ca407285c3c1715077d230581f.tar.zst
firejail-d6b542c89e1ba8ca407285c3c1715077d230581f.zip
pidstr needs 11 bytes (10 + NULL)
also use %d because index is signed int. Found by compiler: netstats.c:165:23: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=] snprintf(pidstr, 10, "%u", index); ^~~~ In file included from /usr/include/stdio.h:938:0, from firemon.h:24, from netstats.c:20: /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 2 and 11 bytes into a destination of size 10
Diffstat (limited to 'src/firemon')
-rw-r--r--src/firemon/netstats.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/firemon/netstats.c b/src/firemon/netstats.c
index ad123be50..c68e2e51b 100644
--- a/src/firemon/netstats.c
+++ b/src/firemon/netstats.c
@@ -161,8 +161,8 @@ static void print_proc(int index, int itv, int col) {
161 } 161 }
162 162
163 // pid 163 // pid
164 char pidstr[10]; 164 char pidstr[11];
165 snprintf(pidstr, 10, "%u", index); 165 snprintf(pidstr, 11, "%d", index);
166 166
167 // user 167 // user
168 char *user = get_user_name(pids[index].uid); 168 char *user = get_user_name(pids[index].uid);