diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2022-09-14 14:50:04 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2022-09-15 16:50:28 -0400 |
commit | 73df7b643b8734383047675669de45660a983a7b (patch) | |
tree | 4da899a9d9c3c39cd08aab6fac57fac85f01dd5b /src/mod_cgi.c | |
parent | 3991099ea09370463cec7dac3527678284669ff9 (diff) | |
download | lighttpd-git-73df7b643b8734383047675669de45660a983a7b.tar.gz |
[core] manually calculate off_t max (fixes #3171)
manually calculate off_t max for broken cross-compilation systems which
fail to enable large file support (so sizeof(off_t) != sizeof(int64_t))
If sizeof(off_t) != sizeof(int64_t), a negative number could end up in
cq->upload_temp_file_size when it was assigned INTMAX_MAX, leading to
excessive new temporary file creation occurring on each and every write.
x-ref:
"File upload regression with --disable-lfs"
https://redmine.lighttpd.net/issues/3171
Diffstat (limited to 'src/mod_cgi.c')
-rw-r--r-- | src/mod_cgi.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mod_cgi.c b/src/mod_cgi.c index af0a4884..bc477399 100644 --- a/src/mod_cgi.c +++ b/src/mod_cgi.c @@ -1028,7 +1028,8 @@ URIHANDLER_FUNC(cgi_is_handled) { && !(r->conf.stream_request_body /*(if not streaming request body)*/ & (FDEVENT_STREAM_REQUEST|FDEVENT_STREAM_REQUEST_BUFMIN))) { /* store request body in single tempfile if not streaming request body*/ - r->reqbody_queue.upload_temp_file_size = INTMAX_MAX; + r->reqbody_queue.upload_temp_file_size = + (off_t)((1uLL << (sizeof(off_t)*8-1))-1); } { |