]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: use snprintf() instead of sprintf()
authorKarel Zak <kzak@redhat.com>
Tue, 7 Oct 2025 10:02:44 +0000 (12:02 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 7 Oct 2025 10:02:44 +0000 (12:02 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lsfd-cmd/sock.c

index 2780c9f34255829826e1c6e8f2ed4975af8a7b63..59824b7d0c90f9712a2de4fa9502206acd6f02c9 100644 (file)
@@ -152,9 +152,9 @@ static void init_sock_content(struct file *file)
                assert(file->proc);
 
                if (is_opened_file(file))
-                       sprintf(path, "/proc/%d/fd/%d", file->proc->pid, fd);
+                       snprintf(path, sizeof(path), "/proc/%d/fd/%d", file->proc->pid, fd);
                else
-                       sprintf(path, "/proc/%d/map_files/%"PRIx64 "-%" PRIx64,
+                       snprintf(path, sizeof(path), "/proc/%d/map_files/%"PRIx64 "-%" PRIx64,
                                file->proc->pid,
                                file->map_start,
                                file->map_end);