mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 09:12:44 +00:00
MFC r281928:
Avoid an infinite loop by ensuring that the amount of bytes read is greater than 0 in MDXFileChunk when calculating the checksum This edgecase can be triggered if the file is truncated while the checksum is being calculated (i.e. the EOF is reached) Differential Revision: https://reviews.freebsd.org/D2351 (patch by darius) PR: 196694 Reviewed by: delphij, ngie Submitted by: Daniel O'Connor <darius@dons.net.au> Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
1846e46c21
commit
5ed1b7dd32
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=283054
@ -74,7 +74,7 @@ MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len)
|
||||
i = read(f, buffer, sizeof(buffer));
|
||||
else
|
||||
i = read(f, buffer, n);
|
||||
if (i < 0)
|
||||
if (i <= 0)
|
||||
break;
|
||||
MDXUpdate(&ctx, buffer, i);
|
||||
n -= i;
|
||||
|
Loading…
Reference in New Issue
Block a user