Skip to content

Commit

Permalink
in_http: fix parser memory reinitialization [2.0 backport]
Browse files Browse the repository at this point in the history
This fixes the reinitialization of the parser with the size
of the parser struct instead of the size of a parser function.
The original code appeared to be a typo and prevented the build
for Windows with this plugin.

Also enabled in_http plugin in Windows cmake file.

Note: this is a backport of #7407

Signed-off-by: Shing Tsoi <[email protected]>

enabled in_http
  • Loading branch information
tszshingt committed May 17, 2023
1 parent bf3da78 commit 690d041
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmake/windows-setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(FLB_WINDOWS_DEFAULTS)
set(FLB_IN_EXEC_WASI No)
set(FLB_IN_FORWARD Yes)
set(FLB_IN_HEALTH No)
set(FLB_IN_HTTP No)
set(FLB_IN_HTTP Yes)
set(FLB_IN_MEM No)
set(FLB_IN_KMSG No)
set(FLB_IN_LIB Yes)
Expand Down
4 changes: 2 additions & 2 deletions plugins/in_http/http_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static int http_conn_event(void *data)
* handled, the additional memset intends to wipe any left over data
* from the headers parsed in the previous request.
*/
memset(&conn->session.parser, 0, sizeof(mk_http_parser));
memset(&conn->session.parser, 0, sizeof(struct mk_http_parser));
mk_http_parser_init(&conn->session.parser);
http_conn_request_init(&conn->session, &conn->request);
}
Expand All @@ -146,7 +146,7 @@ static int http_conn_event(void *data)
* handled, the additional memset intends to wipe any left over data
* from the headers parsed in the previous request.
*/
memset(&conn->session.parser, 0, sizeof(mk_http_parser));
memset(&conn->session.parser, 0, sizeof(struct mk_http_parser));
mk_http_parser_init(&conn->session.parser);
http_conn_request_init(&conn->session, &conn->request);
}
Expand Down

0 comments on commit 690d041

Please sign in to comment.