mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
qemu-img: improve queue depth validation in img_bench
This error was discovered by fuzzing qemu-img. Currently, running `qemu-img bench -d 0` in img_bench is allowed, which is a pointless operation and causes qemu-img to hang. Signed-off-by: Denis Rastyogin <gerben@altlinux.org> Message-ID: <20250327162423.25154-5-gerben@altlinux.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
ed1aef1716
commit
2b689db0be
1 changed files with 1 additions and 1 deletions
|
|
@ -4571,7 +4571,7 @@ static int img_bench(int argc, char **argv)
|
||||||
{
|
{
|
||||||
unsigned long res;
|
unsigned long res;
|
||||||
|
|
||||||
if (qemu_strtoul(optarg, NULL, 0, &res) < 0 || res > INT_MAX) {
|
if (qemu_strtoul(optarg, NULL, 0, &res) <= 0 || res > INT_MAX) {
|
||||||
error_report("Invalid queue depth specified");
|
error_report("Invalid queue depth specified");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue