[PATCH 1/1] httpd: fix offset for sendfile

Denys Vlasenko vda.linux at googlemail.com
Tue Dec 29 23:06:33 UTC 2020


Applied, thank you

On Tue, Dec 29, 2020 at 4:29 PM Maxim Storchak <m.storchak at gmail.com> wrote:
>
> If the Range: header is not present it the request,
> the offset passed to sendfile is wrong,
> and httpd falls back to the read-write loop.
>
> Signed-off-by: Maxim Storchak <m.storchak at gmail.com>
> ---
>  networking/httpd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/networking/httpd.c b/networking/httpd.c
> index 4346141ee..cc9828e78 100644
> --- a/networking/httpd.c
> +++ b/networking/httpd.c
> @@ -1871,7 +1871,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
>                 send_headers(HTTP_OK);
>  #if ENABLE_FEATURE_USE_SENDFILE
>         {
> -               off_t offset = range_start;
> +               off_t offset = (range_start==-1)?0:range_start;
>                 while (1) {
>                         /* sz is rounded down to 64k */
>                         ssize_t sz = MAXINT(ssize_t) - 0xffff;
> --
> 2.28.0
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list