svn commit: r280044 - head/usr.sbin/bhyve

Alexander Motin mav at FreeBSD.org
Sun Mar 15 17:45:17 UTC 2015


Author: mav
Date: Sun Mar 15 17:45:16 2015
New Revision: 280044
URL: https://svnweb.freebsd.org/changeset/base/280044

Log:
  According to Linux and QEMU, s/n equal to buffer is not zero-terminated.
  
  This makes same s/n reported for both virtio and AHCI drivers.
  
  MFC after:	2 weeks

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

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_block.c	Sun Mar 15 17:39:38 2015	(r280043)
+++ head/usr.sbin/bhyve/pci_virtio_block.c	Sun Mar 15 17:45:16 2015	(r280044)
@@ -263,7 +263,9 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
 		break;
 	case VBH_OP_IDENT:
 		/* Assume a single buffer */
-		strlcpy(iov[1].iov_base, sc->vbsc_ident,
+		/* S/n equal to buffer is not zero-terminated. */
+		memset(iov[1].iov_base, 0, iov[1].iov_len);
+		strncpy(iov[1].iov_base, sc->vbsc_ident,
 		    MIN(iov[1].iov_len, sizeof(sc->vbsc_ident)));
 		pci_vtblk_done(&io->io_req, 0);
 		return;


More information about the svn-src-head mailing list