erofs-utils: lib: fix off-by-one issue with invalid device ID
PATCH 1/1 erofs-utils: lib: fix off-by-one issue with invalid device ID
The device ID should be no less than 1 + number of blobs. In other words, it should be greater than number of blobs.
Fixes 89dfe997c2ee ("erofs-utils: lib: fix global-buffer-overflow due to invalid device")
Signed-off-by Gao Xiang <[email protected]>
--- lib/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/io.c +1 -1
@@ -342,7 +342,7 @@ ssize_t erofs_dev_read(struct erofs_sb_info *sbi, int device_id,ssize_t read;if (device_id) { -if (device_id >= sbi->nblobs) { +if (device_id > sbi->nblobs) {erofs_err ("invalid device id %d" , device_id);return -EIO ; }
Signature · 1 line
2.43.5