Skip to content

Commit

Permalink
DM: xHCI: array bound checking before it is used
Browse files Browse the repository at this point in the history
Array index of "vbdp_devs" may be out of bounds if
"i >= XHCI_MAX_VIRT_PORTS", so index checking is necessary.

Tracked-On: #1252
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
  • Loading branch information
tianhuas authored and wenlingz committed Jan 3, 2019
1 parent 8ed393a commit 01c8f54
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions devicemodel/hw/pci/xhci.c
Expand Up @@ -721,6 +721,9 @@ xhci_vbdp_thread(void *data)
break;
}

if (i >= XHCI_MAX_VIRT_PORTS)
continue;

j = pci_xhci_get_native_port_index_by_path(xdev,
&xdev->vbdp_devs[i].path);
if (j < 0)
Expand Down

0 comments on commit 01c8f54

Please sign in to comment.