Skip to content
Open
Changes from 1 commit
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
1 change: 1 addition & 0 deletions plugins/in_tcp/tcp_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ static ssize_t parse_payload_none(struct tcp_conn *conn)
else {
flb_plg_debug(ctx->ins, "parser '%s' failed on incoming data",
ctx->parser_name);
flb_plg_debug(ctx->ins, "unparsed log message: %.*s", len, buf);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cast the precision argument before logging

On parser failures this passes len as the precision for %.*s, but len is a size_t while printf precision requires an int; with the variadic flb_plg_debug call this is undefined behavior and can truncate or misinterpret large TCP records, potentially logging past the intended message. Bound the length and pass an int precision, as other callers in this tree do.

Useful? React with 👍 / 👎.

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
ret = flb_log_event_encoder_begin_record(ctx->log_encoder);

if (ret == FLB_EVENT_ENCODER_SUCCESS) {
Expand Down
Loading