From: delphij Date: Thu, 17 Sep 2015 18:11:26 +0000 (+0000) Subject: Use strlcpy() instead of strncpy() because subsequent mkstemps expects X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=45de05604807779a942c9ec68c311a48ced3fe8c;p=people%2Fjulieng%2Ffreebsd.git 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 --- diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c index a9dd1cc733c3..57fe7839a22f 100644 --- a/usr.sbin/bhyve/acpi.c +++ b/usr.sbin/bhyve/acpi.c @@ -790,10 +790,10 @@ basl_open(struct basl_fio *bf, int suffix) 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); }