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

David Marchand david.marchand at redhat.com
Wed Feb 4 12:21:42 CET 2026


On Thu, 29 Jan 2026 at 02:43, Stephen Hemminger
<stephen at 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 at 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



More information about the dev mailing list