Sanity check ptr for legal values so it is less likely
(but not impossible) to get stuck in an infinite loop. Obtained from: msmith@freebsd.org
This commit is contained in:
parent
5bbc321312
commit
afd27fce94
@ -379,6 +379,12 @@ pci_read_extcap(device_t pcib, pcicfgregs *cfg)
|
||||
* Read capability entries.
|
||||
*/
|
||||
while (nextptr != 0) {
|
||||
/* Sanity check */
|
||||
if (nextptr > 255) {
|
||||
printf("illegal PCI extended capability offset %d\n",
|
||||
nextptr);
|
||||
return;
|
||||
}
|
||||
/* Find the next entry */
|
||||
ptr = nextptr;
|
||||
nextptr = REG(ptr + 1, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user