Hi Theo,

On Fri, May 27, 2022 at 5:33 PM Theo de Raadt <dera...@openbsd.org> wrote:
>
> I think this is the fix.  The first bit is walking off the list.
> The 2nd part might help for programs which call libpcap repeatedly.

I've just applied the patch and recompiled libpcap.  It seems to work:

# tcpdump -nl -i bge0 -F /tmp/filter.cf
tcpdump: listening on bge0, link-type EN10MB

Thanks!

-Kor

>
> Index: gencode.c
> ===================================================================
> RCS file: /cvs/src/lib/libpcap/gencode.c,v
> retrieving revision 1.61
> diff -u -r1.61 gencode.c
> --- gencode.c   28 Mar 2022 02:58:06 -0000      1.61
> +++ gencode.c   27 May 2022 20:30:53 -0000
> @@ -207,12 +207,13 @@
>         for (i = 0; i <= cur_membag; i++) {
>                 if (membag[i].ptrs == NULL)
>                         continue;
> -               for (j = 0; j <= membag[i].slot; j++)
> +               for (j = 0; j < membag[i].slot; j++)
>                         free(membag[i].ptrs[j]);
>                 free(membag[i].ptrs);
>                 membag[i].ptrs = NULL;
>                 membag[i].slot = membag[i].total = 0;
>         }
> +       cur_membag = 0;
>  }
>
>  /*

Reply via email to