]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
dmesg: use snprintf() instead of sprintf()
authorKarel Zak <kzak@redhat.com>
Tue, 7 Oct 2025 09:57:06 +0000 (11:57 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 7 Oct 2025 09:57:06 +0000 (11:57 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/dmesg.c

index 6584613c772164fd6d7e6464a00c149db62610b3..f4b0484002563ef80dac555a03e03999c1582da4 100644 (file)
@@ -1273,7 +1273,7 @@ full_output:
                } else {
                        char cidbuf[PID_CHARS_MAX+3] = {'\0'};
 
-                       sprintf(cidbuf, "[%*s] ",
+                       snprintf(cidbuf, sizeof(cidbuf), "[%*s] ",
                                (char)ctl->caller_id_size, rec->caller_id);
                        ctl->indent += strnlen(cidbuf, sizeof(cidbuf));
                        fputs(cidbuf, stdout);