Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 May 2018 03:09:09 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334272 - head/usr.sbin/bhyve
Message-ID:  <201805280309.w4S399cS091555@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vangyzen
Date: Mon May 28 03:09:09 2018
New Revision: 334272
URL: https://svnweb.freebsd.org/changeset/base/334272

Log:
  bhyve: guarantee NUL termination
  
  Use strlcpy to guarantee NUL termination of the path to a
  virtio console socket.
  
  Reported by:	Coverity
  CID:		1362874
  Sponsored by:	Dell EMC

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

Modified: head/usr.sbin/bhyve/pci_virtio_console.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_console.c	Mon May 28 03:05:01 2018	(r334271)
+++ head/usr.sbin/bhyve/pci_virtio_console.c	Mon May 28 03:09:09 2018	(r334272)
@@ -306,7 +306,7 @@ pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const c
 	sun.sun_family = AF_UNIX;
 	sun.sun_len = sizeof(struct sockaddr_un);
 	strcpy(pathcopy, path);
-	strncpy(sun.sun_path, basename(pathcopy), sizeof(sun.sun_path));
+	strlcpy(sun.sun_path, basename(pathcopy), sizeof(sun.sun_path));
 	free(pathcopy);
 
 	if (bindat(fd, s, (struct sockaddr *)&sun, sun.sun_len) < 0) {



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