[PATCH 1/3] examples/server_node_efd: fix format overflow

Stephen Hemminger
2025-11-10T18:22:21Z

If format-truncation is enabled, the compiler detects a string overflow
since the snprintf() is putting ethernet address and new line
in buffer only sized for the address.

Fixes: 39aad0e88c58 ("examples/flow_distributor: new example to demonstrate EFD")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/server_node_efd/efd_server/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/server_node_efd/efd_server/main.c b/examples/server_node_efd/efd_server/main.c
index 75ff0ea532..62c3f4a16d 100644
--- a/examples/server_node_efd/efd_server/main.c
+++ b/examples/server_node_efd/efd_server/main.c
@@ -68,7 +68,7 @@ static const char *
get_printable_mac_addr(uint16_t port)
{
static const char err_address[] = "00:00:00:00:00:00";
- static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)];
+ static char addresses[RTE_MAX_ETHPORTS][RTE_ETHER_ADDR_FMT_SIZE + 1];
struct rte_ether_addr mac;
int ret;

--
2.51.0