summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdinstall
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2017-09-14 00:39:08 +0000
committeremaste <emaste@FreeBSD.org>2017-09-14 00:39:08 +0000
commit345d61c9f4b7a8ba68c046aa498fb159614573cf (patch)
tree0d89833b39371258bca4edacac702882f42de13b /usr.sbin/bsdinstall
parentddac6973f64bbe6667604927b2a0eb87e597c556 (diff)
downloadFreeBSD-src-345d61c9f4b7a8ba68c046aa498fb159614573cf.zip
FreeBSD-src-345d61c9f4b7a8ba68c046aa498fb159614573cf.tar.gz
MFC r316802 (cem): bsdinstall(8): Sprinkle a snprintf to fixed size buffer
Use a snprintf to write an environment variable to a fixed-size buffer to avoid stack overflow. Reported by: Coverity (CWE-120) CID: 1238926 Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/bsdinstall')
-rw-r--r--usr.sbin/bsdinstall/partedit/gpart_ops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c
index dc1c95c..a502e72 100644
--- a/usr.sbin/bsdinstall/partedit/gpart_ops.c
+++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c
@@ -148,7 +148,7 @@ newfs_command(const char *fstype, char *command, int use_default)
strcpy(command, "zpool create -f -m none ");
if (getenv("BSDINSTALL_TMPBOOT") != NULL) {
char zfsboot_path[MAXPATHLEN];
- sprintf(zfsboot_path, "%s/zfs",
+ snprintf(zfsboot_path, sizeof(zfsboot_path), "%s/zfs",
getenv("BSDINSTALL_TMPBOOT"));
mkdir(zfsboot_path, S_IRWXU | S_IRGRP | S_IXGRP |
S_IROTH | S_IXOTH);
OpenPOWER on IntegriCloud