summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-03-27 08:56:44 +0000
committermav <mav@FreeBSD.org>2015-03-27 08:56:44 +0000
commit4b55b3039458f78b33fedc1b6f6125af629c3bc3 (patch)
tree7db5affae5665c47834ce5db34966d98755edcb5 /usr.sbin
parent1265da624b5256bd9e9b0bccf3704e59cb93b3fd (diff)
downloadFreeBSD-src-4b55b3039458f78b33fedc1b6f6125af629c3bc3.zip
FreeBSD-src-4b55b3039458f78b33fedc1b6f6125af629c3bc3.tar.gz
MFC r280044:
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.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bhyve/pci_virtio_block.c4
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;
OpenPOWER on IntegriCloud