diff options
author | mav <mav@FreeBSD.org> | 2015-03-15 17:45:16 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-03-15 17:45:16 +0000 |
commit | 0a32d979123c630742066439cdbce5dc67e1e8dc (patch) | |
tree | 54e2bd42704401f7ae85d31f1070dc969715c4fb /usr.sbin/bhyve | |
parent | 209179a5f9cb7c182bb7d388b1feb41a930f2fe5 (diff) | |
download | FreeBSD-src-0a32d979123c630742066439cdbce5dc67e1e8dc.zip FreeBSD-src-0a32d979123c630742066439cdbce5dc67e1e8dc.tar.gz |
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
Diffstat (limited to 'usr.sbin/bhyve')
-rw-r--r-- | usr.sbin/bhyve/pci_virtio_block.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c index cdfd466..b0d3830 100644 --- a/usr.sbin/bhyve/pci_virtio_block.c +++ b/usr.sbin/bhyve/pci_virtio_block.c @@ -263,7 +263,9 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq) 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; |