mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 04:08:32 +00:00
Fix some glitches in redbean
This change includes a fix to Fetch() where an out of bounds memory read could happen, when the reverse proxied endpoint omits the content-length header. This caused a bunch of NUL chars to appear on TurfWar's /statusz since it wouldn't actually overrun the buffer, and if it did it would've been caught by MODE=asan builds.
This commit is contained in:
parent
14d036b68d
commit
6b06a8176d
6 changed files with 7 additions and 7 deletions
|
@ -364,7 +364,7 @@ static int LuaFetch(lua_State *L) {
|
|||
break;
|
||||
case kHttpClientStateBody:
|
||||
if (!g) {
|
||||
paylen = inbuf.n;
|
||||
paylen = inbuf.n - hdrsize;
|
||||
goto Finished;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -6153,7 +6153,7 @@ static char *ServeAsset(struct Asset *a, const char *path, size_t pathlen) {
|
|||
((cpm.contentlength >= 100 && _startswithi(ct, "text/")) ||
|
||||
(cpm.contentlength >= 1000 &&
|
||||
MeasureEntropy(cpm.content, 1000) < 7))) {
|
||||
WARNF("serving compressed asset");
|
||||
VERBOSEF("serving compressed asset");
|
||||
p = ServeAssetCompressed(a);
|
||||
} else {
|
||||
p = ServeAssetIdentity(a, ct);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue