diff options
author | Benoît Ganne <bganne@cisco.com> | 2020-07-24 17:04:06 +0200 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2020-07-24 21:13:05 +0000 |
commit | e3a24300d08f04146935ec0d3b02e03276d6cc68 (patch) | |
tree | c2328fad0cb2bea0130a7b0f0d39b543c62238b1 /src | |
parent | c7fd24e30bb5ac68f3c82eafee9dc192289add7f (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>
Diffstat (limited to 'src')
-rw-r--r-- | src/vlib/linux/vfio.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vlib/linux/vfio.c b/src/vlib/linux/vfio.c index 33de135965b..dc68c52db02 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) { |