httpd ranges do not work over 4gb
Denys Vlasenko
vda.linux at googlemail.com
Fri Oct 8 13:58:47 UTC 2021
On Fri, Oct 8, 2021 at 2:45 PM Lauri Kasanen <cand at gmx.com> wrote:
>
> Hi,
>
> On current bb master httpd, when the client requests valid Range: bytes
> over 4gb, the response is wrong - it sends the entire file instead of
> the requested range.
>
> E.g.
> Range: bytes=5926192128-5926195199
>
> This is on x86_64, so CONFIG_LFS etc shouldn't matter. I haven't
> yet looked deeper if it's just a matter of using 64-bit vars.
Bug in libbb.h:
#else
/* CONFIG_LFS is off */
# if UINT_MAX == 0xffffffff
/* While sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway.
* gcc will throw warnings on printf("%d", off_t). Crap... */
typedef unsigned long uoff_t;
# define XATOOFF(a) xatoi_positive(a)
# define BB_STRTOOFF bb_strtou
# define STRTOOFF strtol
# define OFF_FMT "l"
WRONG. If CONFIG_LFS is off, sizeof(off_t) can be larger than sizeof(int).
x86_64 is an example.
Fixed in git, please test.
More information about the busybox
mailing list