Commit 2c833c23 authored by Eduardo Villanueva Che's avatar Eduardo Villanueva Che Committed by Milan Broz

Fixed veritysetup bug with hash offsets bigger than 2gb.

The lseek in function write_blockwise() could return value
that is greater than integer for result so it can overflow
and fail the whole write.
[comment added by mbroz]
parent 34734395
......@@ -155,9 +155,9 @@ ssize_t write_blockwise(int fd, int bsize, void *orig_buf, size_t count)
if (r < bsize)
bsize = r;
r = lseek(fd, -bsize, SEEK_CUR);
if (r < 0)
if (lseek(fd, -bsize, SEEK_CUR) < 0)
goto out;
memcpy(hangover_buf, (char*)buf + solid, hangover);
r = write_buffer(fd, hangover_buf, bsize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment