HomeFreeBSD

Fix -Wformat-overflow warning in zfs_project_handle_dir()

Description

Fix -Wformat-overflow warning in zfs_project_handle_dir()

Switch to using asprintf() to satisfy the compiler and resolve the
potential format-overflow warning. Not the conditional before the
sprintf() would have prevented this regardless.

cmd/zfs/zfs_project.c: In function ‘zfs_project_handle_dir’:
cmd/zfs/zfs_project.c:241:38: error: ‘/’ directive writing
1 byte into a region of size between 0 and 4352
[-Werror=format-overflow=]
cmd/zfs/zfs_project.c:241:17: note: ‘sprintf’ output between
2 and 4609 bytes into a destination of size 4352

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13528
Closes #13575

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Jun 20 2022, 10:27 PM
Parents
rGf11431a31776: Fix -Wformat-truncation warning in upgrade_set_callback()
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG8aceded193f5: Fix -Wformat-overflow warning in zfs_project_handle_dir() (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Jun 27 2022, 9:19 PM