mirror of https://github.com/OISF/suricata
util/pidfile: address format truncation warning
util-pidfile.c: In function ‘SCPidfileCreate’:
util-pidfile.c:49:18: error: ‘%lu’ directive output may be truncated writing between 1 and 20 bytes into a region of size 16 [-Werror=format-truncation=]
49 | size_t len = snprintf(val, sizeof(val), "%"PRIuMAX"\n", (uintmax_t)getpid());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util-pidfile.c:49:18: note: using the range [0, 18446744073709551615] for directive argument
util-pidfile.c:49:18: note: ‘snprintf’ output between 3 and 22 bytes into a destination of size 16
49 | size_t len = snprintf(val, sizeof(val), "%"PRIuMAX"\n", (uintmax_t)getpid());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Ticket: #7905.
pull/13926/head
parent
746823f3df
commit
8630b29611
Loading…
Reference in New Issue