Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Sep 2015 18:11:27 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287927 - head/usr.sbin/bhyve
Message-ID:  <201509171811.t8HIBRD7029962@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Sep 17 18:11:26 2015
New Revision: 287927
URL: https://svnweb.freebsd.org/changeset/base/287927

Log:
  Use strlcpy() instead of strncpy() because subsequent mkstemps expects
  the string be nul-terminated.
  
  Reviewed by:	neel
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D3685

Modified:
  head/usr.sbin/bhyve/acpi.c

Modified: head/usr.sbin/bhyve/acpi.c
==============================================================================
--- head/usr.sbin/bhyve/acpi.c	Thu Sep 17 17:56:23 2015	(r287926)
+++ head/usr.sbin/bhyve/acpi.c	Thu Sep 17 18:11:26 2015	(r287927)
@@ -790,10 +790,10 @@ basl_open(struct basl_fio *bf, int suffi
 	err = 0;
 
 	if (suffix) {
-		strncpy(bf->f_name, basl_stemplate, MAXPATHLEN);
+		strlcpy(bf->f_name, basl_stemplate, MAXPATHLEN);
 		bf->fd = mkstemps(bf->f_name, strlen(BHYVE_ASL_SUFFIX));
 	} else {
-		strncpy(bf->f_name, basl_template, MAXPATHLEN);
+		strlcpy(bf->f_name, basl_template, MAXPATHLEN);
 		bf->fd = mkstemp(bf->f_name);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509171811.t8HIBRD7029962>