DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	nikolay@cumulusnetworks.com
Subject: [dpdk-dev] [PATCH 2/5] bridge: fix string length warning
Date: Sun, 29 Nov 2020 09:54:34 -0800
Message-ID: <20201129175437.15346-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20201129175437.15346-1-stephen@networkplumber.org>

Gcc-10 complains about possible string length overflow.
This can't happen Ethernet address format is always limited to
18 characters or less. Just resize the temp buffer.

Fixes: 70dfb0b8836d ("iplink: bridge: export bridge_id and designated_root")
Cc: nikolay@cumulusnetworks.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 ip/iplink_bridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
index 3e81aa059cb3..d12fd0558f7d 100644
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -74,7 +74,7 @@ static void explain(void)
 
 void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len)
 {
-	char eaddr[32];
+	char eaddr[18];
 
 	ether_ntoa_r((const struct ether_addr *)id->addr, eaddr);
 	snprintf(buf, len, "%.2x%.2x.%s", id->prio[0], id->prio[1], eaddr);
-- 
2.29.2


  parent reply	other threads:[~2020-11-29 17:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-29 17:54 [dpdk-dev] [PATCH iproute2 0/5] fix warnings from gcc-10 Stephen Hemminger
2020-11-29 17:54 ` [dpdk-dev] [PATCH 1/5] devlink: fix unitialized warning Stephen Hemminger
2020-11-29 17:54 ` Stephen Hemminger [this message]
2020-11-29 17:54 ` [dpdk-dev] [PATCH 3/5] tc: fix compiler warnings in ip6 pedit Stephen Hemminger
2020-11-29 17:54 ` [dpdk-dev] [PATCH 4/5] misc: fix compiler warning in ifstat and nstat Stephen Hemminger
2020-11-29 17:54 ` [dpdk-dev] [PATCH 5/5] f_u32: fix compiler gcc-10 compiler warning Stephen Hemminger
2020-11-30  0:17 ` [dpdk-dev] [PATCH iproute2 0/5] fix warnings from gcc-10 Stephen Hemminger

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=20201129175437.15346-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=nikolay@cumulusnetworks.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git