In the for loop, the if condition is always true, and will execute memmove. But it will cause the list->devs[i+1] overflow while i equals list->count-1. Signed-off-by: Gonglei <arei.gonglei@xxxxxxxxxx> --- src/util/virusb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/util/virusb.c b/src/util/virusb.c index d34e44f..30d0b12 100644 --- a/src/util/virusb.c +++ b/src/util/virusb.c @@ -497,7 +497,7 @@ virUSBDeviceListSteal(virUSBDeviceListPtr list, ret = list->devs[i]; - if (i != list->count--) + if (i != --list->count) memmove(&list->devs[i], &list->devs[i+1], sizeof(*list->devs) * (list->count - i)); -- 1.7.3.1 Best Regards, -Gonglei -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list