fix off-by-one

This change strengthens a bounds check to make sure no out of bound indexing occurs when using a port.
This commit is contained in:
Ilja van Sprundel 2019-10-06 20:31:18 +02:00 committed by GitHub
parent 37230bf0c3
commit 6d152649a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -417,7 +417,7 @@ hub_task(void * UNUSED(arg))
HUB_DEBUG_MSG("bHubContrCurrent %4X", d->bHubContrCurrent);
/* Check for sane number of ports... */
if (d->bNbrPorts > USB_HUB_PORT_LIMIT) {
if (d->bNbrPorts >= USB_HUB_PORT_LIMIT) {
HUB_MSG("Too many hub ports declared: %d", d->bNbrPorts);
goto HUB_ERROR;
}