Skip to content

Commit

Permalink
http_server: added parser reset code to prevent use after free as
Browse files Browse the repository at this point in the history
pointed out by Phil in PR 8643

Signed-off-by: Leonardo Alminana <[email protected]>
  • Loading branch information
leonardo-albertovich authored and edsiper committed Mar 31, 2024
1 parent 20c461a commit 9b40a31
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/http_server/flb_http_server_http1.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ static void dummy_mk_http_session_init(struct mk_http_session *session,
static void dummy_mk_http_request_init(struct mk_http_session *session,
struct mk_http_request *request)
{
if (request->stream.channel != NULL) {
mk_stream_release(&request->stream);
}

memset(request, 0, sizeof(struct mk_http_request));

mk_http_request_init(session, request, session->server);
Expand Down Expand Up @@ -495,5 +499,9 @@ int flb_http1_server_session_ingest(struct flb_http1_server_session *session,
http1_evict_request(session);
}

dummy_mk_http_request_init(&session->inner_session, &session->inner_request);

mk_http_parser_init(&session->inner_parser);

return HTTP_SERVER_SUCCESS;
}

0 comments on commit 9b40a31

Please sign in to comment.