diff options
author | Pali Rohár <pali@kernel.org> | 2021-12-26 23:47:03 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2021-12-26 23:50:21 +0100 |
commit | 1eb437a40746c1791e7248193a17f92ddbabdd21 (patch) | |
tree | 0a4ea21165589f3f16a70f78c4cc773506c667fd | |
parent | b1cff3a42f162b081ddf77fc9e075797b7aa80e5 (diff) | |
download | pciutils-1eb437a40746c1791e7248193a17f92ddbabdd21.tar.gz |
libpci: Fix intel_sanity_check() function
Function intel_sanity_check() calls conf1_read() which access d->domain
field. But intel_sanity_check() does not initialize this field and so
conf1_read() access some random data on stack.
Tests showed that intel_sanity_check() always fails as in d->domain is
stored some non-zero number.
Fix this issue by zeroing struct pci_dev d in intel_sanity_check() as
sanity check is verifying PCI devices at domain 0.
-rw-r--r-- | lib/i386-ports.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/i386-ports.c b/lib/i386-ports.c index 8b7ceb7..20bce94 100644 --- a/lib/i386-ports.c +++ b/lib/i386-ports.c @@ -75,6 +75,7 @@ intel_sanity_check(struct pci_access *a, struct pci_methods *m) { struct pci_dev d; + memset(&d, 0, sizeof(d)); a->debug("...sanity check"); d.bus = 0; d.func = 0; |