Skip to content

Commit

Permalink
Next
Browse files Browse the repository at this point in the history
PUBLISHED_FROM=6fa0be81ce429b8db9e3ed572cb4a876b6fb2693
  • Loading branch information
cpq authored and cesantabot committed Jul 12, 2019
1 parent b619637 commit 1a38e91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -6289,7 +6289,7 @@ int mg_parse_http(const char *s, int n, struct http_message *hm, int is_req) {
}
} else {
s = mg_skip(s, end, " ", &hm->proto);
if (end - s < 4 || s[3] != ' ') return -1;
if (end - s < 4 || s[0] < '0' || s[0] > '9' || s[3] != ' ') return -1;
hm->resp_code = atoi(s);
if (hm->resp_code < 100 || hm->resp_code >= 600) return -1;
s += 4;
Expand Down
2 changes: 1 addition & 1 deletion src/mg_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ int mg_parse_http(const char *s, int n, struct http_message *hm, int is_req) {
}
} else {
s = mg_skip(s, end, " ", &hm->proto);
if (end - s < 4 || s[3] != ' ') return -1;
if (end - s < 4 || s[0] < '0' || s[0] > '9' || s[3] != ' ') return -1;
hm->resp_code = atoi(s);
if (hm->resp_code < 100 || hm->resp_code >= 600) return -1;
s += 4;
Expand Down
6 changes: 5 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ else
COMMON_PARENT = $(SRC_DIR)
endif

TEST_SOURCES = unit_test.c test_util.c test_main.c
TEST_SOURCES = unit_test.c test_util.c test_main.c fuzz.c
AMALGAMATED_SOURCES = ../mongoose.c
KRYPTON_PATH = $(REPO_ROOT)/krypton

Expand Down Expand Up @@ -118,6 +118,10 @@ clean_index_cgi:
@echo -e "CLEAN\tindex.cgi"
@rm -f data/cgi/index.cgi*

fuzz:
$(CC) fuzz.c ../mongoose.c -o /tmp/$@ -fsanitize=fuzzer,address -g -I..
/tmp/$@

# Interactive:
# docker run -v $(CURDIR)/../..:/cesanta -t -i --entrypoint=/bin/bash cesanta/mongoose_test
docker:
Expand Down

0 comments on commit 1a38e91

Please sign in to comment.