mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-18 10:59:45 +00:00
avoid unlikely and harmless but possible read out of bounds
This commit is contained in:
1 parent
b313d697ff
commit
7e376bb860
2 files changed
+2
-2
No files matched your search
@@ -87,7 +87,7 @@ bool mg_match(struct mg_str s, struct mg_str p, struct mg_str *caps) {
|
||||
} else if (i < p.len && (p.buf[i] == '*' || p.buf[i] == '#')) {
|
||||
if (caps && !caps->buf) caps->len = 0, caps->buf = &s.buf[j]; // Init cap
|
||||
ni = i++, nj = j + 1;
|
||||
} else if (nj > 0 && nj <= s.len && (p.buf[ni] == '#' || s.buf[j] != '/')) {
|
||||
} else if (nj > 0 && nj <= s.len && ((ni < p.len && p.buf[ni] == '#') || s.buf[j] != '/')) {
|
||||
i = ni, j = nj;
|
||||
if (caps && caps->buf == NULL && caps->len == 0) {
|
||||
caps--, caps->len = 0; // Restart previous cap
|
||||
|
||||
Reference in new issue
Block a user