HomeFreeBSD

Fix potential buffer overflow in zpool command

Description

Fix potential buffer overflow in zpool command

The ZPOOL_SCRIPTS_PATH environment variable can be passed here. This
allows for arbitrarily long strings to be passed to sprintf(), which can
overflow the buffer.

I missed this in my earlier audit of the codebase. CodeQL's
cpp/unbounded-write check caught this.

Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14264

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Dec 4 2022, 2:43 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Dec 8 2022, 10:14 PM
Parents
rGecccaede680c: zdb: Fix big parameter passed by value
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGba87ed14103d: Fix potential buffer overflow in zpool command (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Dec 8 2022, 10:14 PM