svn commit: r347412 - stable/11/usr.sbin/bhyve

John Baldwin jhb at FreeBSD.org
Thu May 9 22:42:24 UTC 2019


Author: jhb
Date: Thu May  9 22:42:23 2019
New Revision: 347412
URL: https://svnweb.freebsd.org/changeset/base/347412

Log:
  MFC 334272: bhyve: guarantee NUL termination
  
  Use strlcpy to guarantee NUL termination of the path to a
  virtio console socket.

Modified:
  stable/11/usr.sbin/bhyve/pci_virtio_console.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyve/pci_virtio_console.c
==============================================================================
--- stable/11/usr.sbin/bhyve/pci_virtio_console.c	Thu May  9 22:39:24 2019	(r347411)
+++ stable/11/usr.sbin/bhyve/pci_virtio_console.c	Thu May  9 22:42:23 2019	(r347412)
@@ -291,7 +291,7 @@ pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const c
 
 	sun.sun_family = AF_UNIX;
 	sun.sun_len = sizeof(struct sockaddr_un);
-	strncpy(sun.sun_path, basename((char *)path), sizeof(sun.sun_path));
+	strlcpy(sun.sun_path, basename((char *)path), sizeof(sun.sun_path));
 
 	if (bindat(fd, s, (struct sockaddr *)&sun, sun.sun_len) < 0) {
 		error = -1;


More information about the svn-src-all mailing list