Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Fix invalid memory access. #246

Closed
wants to merge 5 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2376,15 +2376,20 @@ http_parser_parse_url(const char *buf, size_t buflen, int is_connect,

/* host must be present if there is a schema */
/* parsing http:///toto will fail */
if ((u->field_set & ((1 << UF_SCHEMA) | (1 << UF_HOST))) != 0) {
if ((u->field_set & (1 << UF_SCHEMA)) &&
(u->field_set & (1 << UF_HOST)) == 0) {
return 1;
}

if (u->field_set & (1 << UF_HOST)) {
if (http_parse_host(buf, u, found_at) != 0) {
return 1;
}
}

/* CONNECT requests can only contain "hostname:port" */
if (is_connect && u->field_set != ((1 << UF_HOST)|(1 << UF_PORT))) {
return 1;
return 1;

This comment was marked as off-topic.

}

if (u->field_set & (1 << UF_PORT)) {
Expand Down