svn commit: r334272 - head/usr.sbin/bhyve
Eric van Gyzen
vangyzen at FreeBSD.org
Mon May 28 03:09:10 UTC 2018
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) {
More information about the svn-src-all
mailing list