Re: [PATCH v14 03/17] graph: avoid overflowing comment buffer

David Marchand
2026-02-04T11:22:02Z

On Thu, 29 Jan 2026 at 02:43, Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> The library builds a pcapng comment to put on each packet but
> the buffer is not big enough for the largest possible graph
> node name, etc. Change to use asprintf() to allow any
> string length. Note, if asprintf() fails it is better to
> still log the packet without comment so no data is lost.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/graph/graph_pcap.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/lib/graph/graph_pcap.c b/lib/graph/graph_pcap.c
> index 08dcda0d28..602be79ced 100644
> --- a/lib/graph/graph_pcap.c
> +++ b/lib/graph/graph_pcap.c
> @@ -194,7 +194,7 @@ graph_pcap_dispatch(struct rte_graph *graph,
> uint16_t nb_objs)
> {
> struct rte_mbuf *mbuf_clones[RTE_GRAPH_BURST_SIZE];
> - char buffer[GRAPH_PCAP_BUF_SZ];

GRAPH_PCAP_BUF_SZ definition can be dropped, as it is not used anymore.
I will fix while applying.

--
David Marchand