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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to