DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Nicolau, Radu" <radu.nicolau@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>, dev@dpdk.org
Cc: stable@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 3/4] examples/mp_server: fix snprintf overflow
Date: Fri, 9 Oct 2020 12:22:27 +0100	[thread overview]
Message-ID: <d45c50fa-680f-c94d-3187-d8a5d2888f28@intel.com> (raw)
In-Reply-To: <20200821171017.50531-4-bruce.richardson@intel.com>


On 8/21/2020 6:10 PM, Bruce Richardson wrote:
> When producing a printable mac address the buffer was appropriately sized
> for holding the mac address exactly, but the actual snprintf included a
> '\n' character at the end, which means that the snprintf technically is
> getting truncated i.e. the \n would not be added due to lack of space.
> This gets flagged as a problem by modern versions of gcc, e.g. on Ubuntu
> 20.04.
>
> main.c:77:37: warning: ‘__builtin___snprintf_chk’ output truncated before the last format character [-Wformat-truncation=]
>     77 |     "%02x:%02x:%02x:%02x:%02x:%02x\n",
>        |                                     ^
>
> Since the \n is getting stripped anyway, we can fix the issue by just
> removing it. In the process we can switch to using the standard ethernet
> address formating function from rte_ether.h.
>
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>
> ---
> V2: switched code to use standard formatting function
> ---

Acked-by: Radu Nicolau <radu.nicolau@intel.com>


  reply	other threads:[~2020-10-09 11:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 11:00 [dpdk-dev] [PATCH 0/4] fixes for example app builds Bruce Richardson
2020-08-14 11:00 ` [dpdk-dev] [PATCH 1/4] power: make guest channel headers public Bruce Richardson
2020-08-14 11:05   ` Bruce Richardson
2020-08-14 11:00 ` [dpdk-dev] [PATCH 2/4] examples/vm_power_manager: fix string truncation warning Bruce Richardson
2020-08-14 11:00 ` [dpdk-dev] [PATCH 3/4] examples/mp_server: fix snprintf overflow Bruce Richardson
2020-08-14 15:01   ` Stephen Hemminger
2020-08-14 11:00 ` [dpdk-dev] [PATCH 4/4] examples/mp_server: clear string truncation warning Bruce Richardson
2020-08-21 17:10 ` [dpdk-dev] [PATCH v2 0/4] fixes for example app builds Bruce Richardson
2020-08-21 17:10   ` [dpdk-dev] [PATCH v2 1/4] power: make guest channel headers public Bruce Richardson
2020-08-26 10:08     ` David Hunt
2020-10-05 21:44     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2020-08-21 17:10   ` [dpdk-dev] [PATCH v2 2/4] examples/vm_power_manager: fix string truncation warning Bruce Richardson
2020-08-26 10:09     ` David Hunt
2020-08-21 17:10   ` [dpdk-dev] [PATCH v2 3/4] examples/mp_server: fix snprintf overflow Bruce Richardson
2020-10-09 11:22     ` Nicolau, Radu [this message]
2020-08-21 17:10   ` [dpdk-dev] [PATCH v2 4/4] examples/mp_server: clear string truncation warning Bruce Richardson
2020-10-09 11:21     ` Nicolau, Radu
2020-10-28 16:26 ` [dpdk-dev] [PATCH v3 0/3] fixes for example app builds Bruce Richardson
2020-10-28 16:27   ` [dpdk-dev] [PATCH v3 1/3] examples/vm_power_manager: fix string truncation warning Bruce Richardson
2020-10-28 16:27   ` [dpdk-dev] [PATCH v3 2/3] examples/mp_server: fix snprintf overflow Bruce Richardson
2020-10-28 16:27   ` [dpdk-dev] [PATCH v3 3/3] examples/mp_server: clear string truncation warning Bruce Richardson
2020-10-30 13:56   ` [dpdk-dev] [PATCH v3 0/3] fixes for example app builds David Marchand

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=d45c50fa-680f-c94d-3187-d8a5d2888f28@intel.com \
    --to=radu.nicolau@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.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).