Subject: | Segmentation fault caused by problem in RawIP.c function compile |
Date: | Wed, 05 Sep 2007 15:45:37 +0200 |
To: | bug-Net-RawIP [...] rt.cpan.org |
From: | Peter Sylvester <Peter.Sylvester [...] edelweb.fr> |
hello,
The following function in Net::RawIP.xs seems to have a bug that may
cause a segmentation fault.
The Safefree routine frees the allocaled structure but later accesses to fp.
The error happens later when setting a filter, libpcap thinks that the
structuire has a length of one giga, whichg is probably some length of
free area in the free list of the heap. Removing the call to Safefree
solves the
problem. I don't know whether there are memory leaks.
Thanks for consideration
Peter Sylvester
int
compile(p,fp,str,optimize,netmask)
pcap_t * p
struct bpf_program *fp
char *str
int optimize
unsigned int netmask
CODE:
fp = (struct bpf_program *)safemalloc(sizeof(struct bpf_program));
RETVAL = pcap_compile(p,fp,str,optimize,netmask);
Safefree(fp);
OUTPUT:
fp
RETVAL
Message body not shown because it is not plain text.