Skip to content

Commit 43b2327

Browse files
gaojunhao0504acrnsi
authored andcommitted
dm: validation for input to public functions
slot value should be checked in range before used to access bi->slotinfo[]. Tracked-On: #3822 Signed-off-by: Gao Junhao <junhao.gao@intel.com> Reviewed-by: Yonghua Huang <yonghua.huang@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
1 parent 477f833 commit 43b2327

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

devicemodel/hw/pci/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,6 +2490,8 @@ pci_get_vdev_info(int slot)
24902490
bi = pci_businfo[0];
24912491
if (bi == NULL)
24922492
return NULL;
2493+
if (slot < 0 || slot >= MAXSLOTS)
2494+
return NULL;
24932495

24942496
si = &bi->slotinfo[slot];
24952497
if (si != NULL)

0 commit comments

Comments
 (0)