mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Fix important bugs in redbean
This change upgrades to the latest Chromium Zlib, fixes bugs in redbean, and introduces better support for reverse proxies like Cloudflare. This change improves the security of redbean and it's recommended that users upgrade to the release that'll follow. This change also updates the docs to clarify how to use the security tools redbean provides e.g. pledge(), unveil(), and the MODE=asan builds which improve memory safety.
This commit is contained in:
parent
994e1f4386
commit
775944a2d0
42 changed files with 8148 additions and 7298 deletions
|
@ -43,16 +43,18 @@ int ParseForwarded(const char *s, size_t n, uint32_t *ip, uint16_t *port) {
|
|||
if (n == -1) n = s ? strlen(s) : 0;
|
||||
if (n) {
|
||||
t = x = i = 0;
|
||||
if ((r = strrchr(s, ','))) {
|
||||
if ((r = memrchr(s, ',', n))) {
|
||||
i = r - s;
|
||||
if ((s[++i] & 255) == ' ') ++i; // skip optional space
|
||||
if ((s[++i] & 255) == ' ') ++i; // skip optional space
|
||||
}
|
||||
do {
|
||||
c = s[i++] & 255;
|
||||
if (isdigit(c)) {
|
||||
t *= 10;
|
||||
t += c - '0';
|
||||
if (t > 255) return -1;
|
||||
if (t > 255) {
|
||||
return -1;
|
||||
}
|
||||
} else if (c == '.') {
|
||||
x <<= 8;
|
||||
x |= t;
|
||||
|
@ -72,7 +74,9 @@ int ParseForwarded(const char *s, size_t n, uint32_t *ip, uint16_t *port) {
|
|||
if (isdigit(c)) {
|
||||
t *= 10;
|
||||
t += c - '0';
|
||||
if (t > 65535) return -1;
|
||||
if (t > 65535) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue