malloc bugs with tcpdump
Giorgos Keramidas
keramida at ceid.upatras.gr
Mon Jan 16 10:03:37 PST 2006
On 2006-01-16 09:30, Sam Leffler <sam at errno.com> wrote:
> I sent the attached patch upstream to the tcpdump folks. Once I hear
> back I'll commit it.
Thanks :)
> Index: pcap-bpf.c
> ===================================================================
> RCS file: /usr/ncvs/src/contrib/libpcap/pcap-bpf.c,v
> retrieving revision 1.1.1.10
> diff -u -r1.1.1.10 pcap-bpf.c
> --- pcap-bpf.c 11 Jul 2005 03:24:42 -0000 1.1.1.10
> +++ pcap-bpf.c 16 Jan 2006 05:48:49 -0000
> @@ -746,7 +746,7 @@
> u_int i;
> int is_ethernet;
>
> - bdl.bfl_list = (u_int *) malloc(sizeof(u_int) * bdl.bfl_len + 1);
> + bdl.bfl_list = (u_int *) malloc(sizeof(u_int) * (bdl.bfl_len + 1));
> if (bdl.bfl_list == NULL) {
> (void)snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
> pcap_strerror(errno));
More information about the freebsd-current
mailing list