1
0
mirror of https://github.com/projectacrn/acrn-hypervisor.git synced 2025-09-07 03:40:27 +00:00

hv:fix possible buffer overflow in 'ptirq_get_intr_data()'

- 'buffer'with size of 'buffer_cnt',  will overflow in
    next loop if 'index == buffer_cnt - 1'.

Tracked-On: 
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yonghua Huang
2018-12-18 21:27:36 +08:00
committed by wenlingz
parent 0d5c65f1d2
commit c4f20c1700

@@ -229,7 +229,7 @@ uint32_t ptirq_get_intr_data(const struct acrn_vm *target_vm, uint64_t *buffer,
buffer[index + 1U] = entry->intr_count;
index += 2U;
if (index >= buffer_cnt) {
if (index > (buffer_cnt - 2U)) {
break;
}
}