Fix invalid memory access when a new driver is probing for hardware and the number of requested devices was already reached.
The probing functions assume that at least one device should be found and passed to the caller, and only after finding such a device they will check that they should eventually stop looking for more devices. While we could make each probing function capable of handling the special-case of finding 0 devices, it is much more consistent to perform the check from the calling function.
This commit is contained in:
parent
fd19773c21
commit
84918fd075
1 changed files with 2 additions and 0 deletions
|
@ -154,6 +154,8 @@ nfc_list_devices (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * ps
|
|||
if (ndr->probe (pnddDevices + (*pszDeviceFound), szDevices - (*pszDeviceFound), &szN)) {
|
||||
*pszDeviceFound += szN;
|
||||
DBG ("%ld device(s) found using %s driver", (unsigned long) szN, ndr->name);
|
||||
if (*pszDeviceFound == szDevices)
|
||||
break;
|
||||
}
|
||||
pndr++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue