From: Ray Kinsella Date: Tue, 2 Nov 2021 13:18:49 +0000 (+0000) Subject: vlib: allocate pci product_name with vec_alloc X-Git-Tag: v22.06-rc0~326 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=4b1e76b8e6f8d9ae7a3455402e4cb179b693a925;p=vpp.git vlib: allocate pci product_name with vec_alloc The pci device product_name array was being allocated with vec_validate, not vec_alloc. This was allocating an additional byte at the end of the array, which was causing a spurious '\0' to be returned in the middle of format strings. Type: fix Fixes: cef87f1a5e Signed-off-by: Ray Kinsella Change-Id: I21e0aa4f0455ee03bd0acc675d0deae02eddea2b --- diff --git a/src/vlib/linux/pci.c b/src/vlib/linux/pci.c index 7c18505bbfc..1e5ab67b25d 100644 --- a/src/vlib/linux/pci.c +++ b/src/vlib/linux/pci.c @@ -347,7 +347,7 @@ vlib_pci_get_device_info (vlib_main_t * vm, vlib_pci_addr_t * addr, break; len = (tag[2] << 8) | tag[1]; - vec_validate (data, len); + vec_alloc (data, len); if (read (fd, data, len) != len) {