netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH conntrack-tools] conntrack: fix compiler warnings
Date: Mon, 17 Jan 2022 17:33:57 +0100	[thread overview]
Message-ID: <YeWadfWhW/QxtvIE@salvia> (raw)
In-Reply-To: <20220117154252.13420-1-fw@strlen.de>

On Mon, Jan 17, 2022 at 04:42:52PM +0100, Florian Westphal wrote:
> .... those do not indicate bugs, but they are distracting.
> 
> 'exp_filter_add' at filter.c:513:2:
> __builtin_strncpy specified bound 16 equals destination size [-Wstringop-truncation]
> read_config_yy.y:1625: warning: '__builtin_snprintf' output may be truncated before the last format character [-Wformat-truncation=]
>  1625 |         snprintf(policy->name, CTD_HELPER_NAME_LEN, "%s", $2);
> read_config_yy.y:1399: warning: '__builtin_snprintf' output may be ...
>  1399 |         snprintf(conf.stats.logfile, FILENAME_MAXLEN, "%s", $2);
> read_config_yy.y:707: warning: '__builtin_snprintf' output may be ...
>   707 |         snprintf(conf.local.path, UNIX_PATH_MAX, "%s", $2);
> read_config_yy.y:179: warning: '__builtin_snprintf' output may be ...
>   179 |         snprintf(conf.lockfile, FILENAME_MAXLEN, "%s", $2);
> read_config_yy.y:124: warning: '__builtin_snprintf' output may be ...
>   124 |         snprintf(conf.logfile, FILENAME_MAXLEN, "%s", $2);
> 
> ... its because the _MAXLEN constants are one less than the output
> buffer size, i.e. could use either .._MAXLEN + 1 or sizeof, this uses
> sizeof().

LGTM, thanks

      reply	other threads:[~2022-01-17 16:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 15:42 [PATCH conntrack-tools] conntrack: fix compiler warnings Florian Westphal
2022-01-17 16:33 ` Pablo Neira Ayuso [this message]

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=YeWadfWhW/QxtvIE@salvia \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --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).