From: Kevin Wolf Date: Mon, 14 Apr 2014 12:47:14 +0000 (+0200) Subject: block: Fix nb_sectors check in bdrv_check_byte_request() X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=54db38a47978381e23e7f6479c31a97b5d352f7e;p=qmiga%2Fqemu.git block: Fix nb_sectors check in bdrv_check_byte_request() nb_sectors is signed, check for negative values. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- diff --git a/block.c b/block.c index 990a7542a9..3b7951eb4f 100644 --- a/block.c +++ b/block.c @@ -2601,7 +2601,7 @@ static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num, int nb_sectors) { - if (nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) { + if (nb_sectors < 0 || nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) { return -EIO; }