git: 956a05c3cbf5 - main - gptzfsboot: Use snprintf() to format file names
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 08 Nov 2026 16:18:28 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=956a05c3cbf5f5cb9d1c4d58e3a5fc22db1446b8
commit 956a05c3cbf5f5cb9d1c4d58e3a5fc22db1446b8
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-11-08 15:40:03 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-08 16:18:13 +0000
gptzfsboot: Use snprintf() to format file names
The stack buffer in fs_list() can be overflowed if a file name is too
long.
Reported by: Yudi Yang <yudi.yang@rice.edu>
MFC after: 1 week
---
stand/i386/gptzfsboot/zfsboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stand/i386/gptzfsboot/zfsboot.c b/stand/i386/gptzfsboot/zfsboot.c
index 72d791ad2364..d82fa2f5e1e5 100644
--- a/stand/i386/gptzfsboot/zfsboot.c
+++ b/stand/i386/gptzfsboot/zfsboot.c
@@ -553,7 +553,7 @@ fs_list(char *arg)
return;
pager_open();
while ((d = readdirfd(fd)) != NULL) {
- sprintf(line, "%s\n", d->d_name);
+ (void)snprintf(line, sizeof(line), "%s\n", d->d_name);
if (pager_output(line))
break;
}