netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Haller <thaller@redhat.com>
To: NetFilter <netfilter-devel@vger.kernel.org>
Cc: Thomas Haller <thaller@redhat.com>
Subject: [PATCH nft v2 6/8] evaluate: don't needlessly clear full string buffer in stmt_evaluate_log_prefix()
Date: Tue, 29 Aug 2023 14:53:35 +0200	[thread overview]
Message-ID: <20230829125809.232318-7-thaller@redhat.com> (raw)
In-Reply-To: <20230829125809.232318-1-thaller@redhat.com>

Signed-off-by: Thomas Haller <thaller@redhat.com>
---
 src/evaluate.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index 71e94a51cc2f..bfe3638bfe54 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -4128,7 +4128,8 @@ static int stmt_evaluate_queue(struct eval_ctx *ctx, struct stmt *stmt)
 
 static int stmt_evaluate_log_prefix(struct eval_ctx *ctx, struct stmt *stmt)
 {
-	char prefix[NF_LOG_PREFIXLEN] = {}, tmp[NF_LOG_PREFIXLEN] = {};
+	char tmp[NF_LOG_PREFIXLEN] = {};
+	char prefix[NF_LOG_PREFIXLEN];
 	size_t len = sizeof(prefix);
 	size_t offset = 0;
 	struct expr *expr;
@@ -4136,6 +4137,8 @@ static int stmt_evaluate_log_prefix(struct eval_ctx *ctx, struct stmt *stmt)
 	if (stmt->log.prefix->etype != EXPR_LIST)
 		return 0;
 
+	prefix[0] = '\0';
+
 	list_for_each_entry(expr, &stmt->log.prefix->expressions, list) {
 		int ret;
 
-- 
2.41.0


  parent reply	other threads:[~2023-08-29 13:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 12:53 [PATCH nft v2 0/8] fix compiler warnings with clang Thomas Haller
2023-08-29 12:53 ` [PATCH nft v2 1/8] netlink: avoid "-Wenum-conversion" warning in dtype_map_from_kernel() Thomas Haller
2023-08-29 12:53 ` [PATCH nft v2 2/8] netlink: avoid "-Wenum-conversion" warning in parser_bison.y Thomas Haller
2023-08-29 12:53 ` [PATCH nft v2 3/8] datatype: avoid cast-align warning with struct sockaddr result from getaddrinfo() Thomas Haller
2023-08-29 12:53 ` [PATCH nft v2 4/8] evaluate: fix check for truncation in stmt_evaluate_log_prefix() Thomas Haller
2023-08-29 12:53 ` [PATCH nft v2 5/8] src: rework SNPRINTF_BUFFER_SIZE() and handle truncation Thomas Haller
2023-08-29 12:53 ` Thomas Haller [this message]
2023-08-29 18:08   ` [PATCH nft v2 6/8] evaluate: don't needlessly clear full string buffer in stmt_evaluate_log_prefix() Pablo Neira Ayuso
2023-08-29 18:55     ` Thomas Haller
2023-08-29 12:53 ` [PATCH nft v2 7/8] src: suppress "-Wunused-but-set-variable" warning with "parser_bison.c" Thomas Haller
2023-08-29 12:53 ` [PATCH nft v2 8/8] include: drop "format" attribute from nft_gmp_print() Thomas Haller
2023-08-29 15:00 ` [PATCH nft v2 0/8] fix compiler warnings with clang Pablo Neira Ayuso
2023-08-29 17:52   ` Thomas Haller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230829125809.232318-7-thaller@redhat.com \
    --to=thaller@redhat.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).