Skip to content

Commit

Permalink
in_http: fix parser memory reinitialization
Browse files Browse the repository at this point in the history
This fixes the reinitialization of the parser with the size
of the parser structure instead of the size of a pointer.

The original code appeared to be a typo and prevented the build
for Windows with this plugin.

Additionally, it enables the http input plugin plugin in Windows.

Note: this is a backport of #7407

Signed-off-by: Shing Tsoi <[email protected]>
  • Loading branch information
tszshingt authored May 17, 2023
1 parent 740254a commit c0cec3a
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 c0cec3a

Please sign in to comment.