Permalink
Browse files

Check HTTP chunk size, ensure it's reasonable

CL: mg: Check HTTP chunk size, ensure it's reasonable

PUBLISHED_FROM=d9f6babd314c092b42ce9e7fe31d6b30a38366a2
  • Loading branch information...
rojer authored and cesantabot committed Sep 27, 2018
1 parent 05c687e commit 8b423530393a232b5a4ca5c4d1adbbfe19560816
Showing with 8 additions and 0 deletions.
  1. +4 −0 mongoose.c
  2. +4 −0 src/mg_http.c
@@ -6311,6 +6311,10 @@ static size_t mg_http_parse_chunk(char *buf, size_t len, char **chunk_data,
n *= 16;
n += (s[i] >= '0' && s[i] <= '9') ? s[i] - '0' : tolower(s[i]) - 'a' + 10;
i++;
if (i > 6) {
/* Chunk size is unreasonable. */
return 0;
}
}
/* Skip new line */
@@ -564,6 +564,10 @@ static size_t mg_http_parse_chunk(char *buf, size_t len, char **chunk_data,
n *= 16;
n += (s[i] >= '0' && s[i] <= '9') ? s[i] - '0' : tolower(s[i]) - 'a' + 10;
i++;
if (i > 6) {
/* Chunk size is unreasonable. */
return 0;
}
}
/* Skip new line */

0 comments on commit 8b42353

Please sign in to comment.