pci: allocate and set length pci product name 21/34321/3
authorRay Kinsella <mdr@ashroe.eu>
Wed, 3 Nov 2021 09:13:41 +0000 (09:13 +0000)
committerMatthew Smith <mgsmith@netgate.com>
Wed, 3 Nov 2021 17:25:20 +0000 (17:25 +0000)
Original fix for this issue, allocated sufficent memory but didn't set the
vector length correctly.

Type: fix
Fixes: 7d0ca6af0

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Change-Id: I3c8ce310d7a6266840a2d8d6b8620254acd042ab

src/vlib/linux/pci.c

index d968fe2..5e53915 100644 (file)
@@ -348,7 +348,7 @@ vlib_pci_get_device_info (vlib_main_t * vm, vlib_pci_addr_t * addr,
            break;
 
          len = (tag[2] << 8) | tag[1];
-         vec_alloc (data, len);
+         vec_validate (data, len - 1);
 
          if (read (fd, data, len) != len)
            {