Date: Thu, 9 May 2019 22:42:23 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347412 - stable/11/usr.sbin/bhyve Message-ID: <201905092242.x49MgNCk020487@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905092242.x49MgNCk020487>