[PATCH] cpukit/libpci: fix potential buffer overflow in pci_cfg_print_code.c
Harrison Edward Gerber
gerberhe11 at gmail.com
Wed May 26 18:58:19 UTC 2021
See also CID 1399721
Closes #4442
---
cpukit/libpci/pci_cfg_print_code.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpukit/libpci/pci_cfg_print_code.c b/cpukit/libpci/pci_cfg_print_code.c
index e758fa661a..e0979db74a 100644
--- a/cpukit/libpci/pci_cfg_print_code.c
+++ b/cpukit/libpci/pci_cfg_print_code.c
@@ -65,8 +65,8 @@ static void pci_cfg_print_device(struct pci_dev *dev, char *prefix)
char name[32];
char buf[8];
printf("%s.resources = {\n", prefix);
- strcpy(buf, prefix);
- strcat(buf, "\t");
+ strlcpy(buf, prefix, sizeof(buf));
+ strlcat(buf, "\t", sizeof(buf));
pci_cfg_print_resources(dev->resources, buf);
printf("%s},\n", prefix);
if (dev->next == NULL) {
--
2.25.1
More information about the devel
mailing list