[Toybox] [PATCH] sendfile_len: fix bounds check.

enh enh at google.com
Wed Jul 31 13:04:58 PDT 2024


We want to check whether the next call we make will try to send more
than 1<<30 bytes, not whether the total number of bytes to transfer is
more than that.

Interestingly, the read() fallback implementation already has the right
check, presumably because files larger than libbuf are commonplace,
whereas files larger than 1<<30 bytes are not.

Tested locally using truncate to create a 2GiB file (which works) and a
2.5GiB file (which does not work), tar to create the tarfile, and then
tar to extract them.
---
 lib/portability.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-sendfile_len-fix-bounds-check.patch
Type: text/x-patch
Size: 1288 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240731/b0eb4579/attachment.bin>


More information about the Toybox mailing list