summaryrefslogtreecommitdiffstats
path: root/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'pci.c')
-rw-r--r--pci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pci.c b/pci.c
index 68c07af..5bd344f 100644
--- a/pci.c
+++ b/pci.c
@@ -51,7 +51,7 @@ extern struct pciusb_entries pci_probe(void) {
r.nb = 0;
r.entries = malloc(sizeof(struct pciusb_entry) * MAX_DEVICES);
- for (dev = pacc->devices; dev; dev = dev->next, r.nb++) {
+ for (dev = pacc->devices; dev && r.nb < MAX_DEVICES; dev = dev->next, r.nb++) {
struct pciusb_entry *e = &r.entries[r.nb];
memset(buf, 0, CONFIG_SPACE_SIZE); // make sure not to retrieve values from previous devices