aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-07-24 17:04:06 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-18 19:47:21 +0000
commit09da69951baf43d1d75c202b4aa021c726ce9550 (patch)
tree7c28b150ffb76d0fa0c6cfd09ce178b2a6e0183a
parent27901c99528fa9d067f79dc2274e5b776dccee86 (diff)
pci: fix non NULL-terminated vector used as C string overflow
Type: fix Change-Id: Iab512ba8c72c9e20aeba2d4265276bcabf095d46 Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit e3a24300d08f04146935ec0d3b02e03276d6cc68)
-rw-r--r--MAINTAINERS7
-rw-r--r--src/vlib/linux/vfio.c9
2 files changed, 12 insertions, 4 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 1b52b737600..ad3dd1649e0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -67,6 +67,13 @@ M: Damjan Marion <damarion@cisco.com>
M: Dave Barach <dave@barachs.net>
F: src/vlib/buffer*.[ch]
+Vector Library - PCI
+I: pci
+M: Damjan Marion <damarion@cisco.com>
+F: src/vlib/pci/
+F: src/vlib/linux/pci.[ch]
+F: src/vlib/linux/vfio.[ch]
+
Binary API Libraries
I: api
M: Dave Barach <dave@barachs.net>
diff --git a/src/vlib/linux/vfio.c b/src/vlib/linux/vfio.c
index 1ed99ceee55..1b901af0c8b 100644
--- a/src/vlib/linux/vfio.c
+++ b/src/vlib/linux/vfio.c
@@ -185,8 +185,9 @@ linux_vfio_group_get_device_fd (vlib_pci_addr_t * addr, int *fdp,
int fd;
*is_noiommu = 0;
- s = format (s, "/sys/bus/pci/devices/%U/iommu_group", format_vlib_pci_addr,
- addr);
+ s =
+ format (s, "/sys/bus/pci/devices/%U/iommu_group%c", format_vlib_pci_addr,
+ addr, 0);
tmpstr = clib_sysfs_link_to_name ((char *) s);
if (tmpstr)
{
@@ -201,8 +202,8 @@ linux_vfio_group_get_device_fd (vlib_pci_addr_t * addr, int *fdp,
}
vec_reset_length (s);
- s = format (s, "/sys/bus/pci/devices/%U/iommu_group/name",
- format_vlib_pci_addr, addr);
+ s = format (s, "/sys/bus/pci/devices/%U/iommu_group/name%c",
+ format_vlib_pci_addr, addr, 0);
err = clib_sysfs_read ((char *) s, "%s", &tmpstr);
if (err == 0)
{