Date: Thu, 14 Sep 2017 00:39:08 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323569 - stable/11/usr.sbin/bsdinstall/partedit Message-ID: <201709140039.v8E0d8US007042@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Thu Sep 14 00:39:08 2017 New Revision: 323569 URL: https://svnweb.freebsd.org/changeset/base/323569 Log: 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 Modified: stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c Thu Sep 14 00:35:27 2017 (r323568) +++ stable/11/usr.sbin/bsdinstall/partedit/gpart_ops.c Thu Sep 14 00:39:08 2017 (r323569) @@ -148,7 +148,7 @@ newfs_command(const char *fstype, char *command, int u 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709140039.v8E0d8US007042>