svn commit: r323569 - stable/11/usr.sbin/bsdinstall/partedit

Ed Maste emaste at FreeBSD.org
Thu Sep 14 00:39:09 UTC 2017


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);


More information about the svn-src-all mailing list