diff --git a/fs/read_write.c b/fs/read_write.c index a091ee4..3712886 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -631,6 +632,9 @@ static ssize_t do_sendfile(int out_fd, i ssize_t retval; int fput_needed_in, fput_needed_out; + /* Avoid potential security holes. User space will get a short count and should loop. */ + count = min(count, (size_t)0x80000000-PAGE_CACHE_SIZE); + /* * Get input file, and verify that it is ok.. */