[Bro-Dev] #532: IP_Hdr class constructor possible problem
Bro Tracker
bro at tracker.bro-ids.org
Tue Aug 2 17:08:37 PDT 2011
#532: IP_Hdr class constructor possible problem
---------------------+------------------------
Reporter: gregor | Owner:
Type: Problem | Status: new
Priority: Normal | Milestone: Bro1.7
Component: Bro | Version: git/master
Keywords: IPv6 |
---------------------+------------------------
{{{
#!rst
The IP_Hdr() is used as an abstract version for an IP header than handles
IPv4 and IPv6 (i.e., struct ip* and struct ip6*). The constructors look
like this::
IP_Hdr(struct ip* arg_ip4)
IP_Hdr(const struct ip* arg_ip4)
(similar for ip6). The class then stores this pointer internally. If the
constructor without the const pointer is used then the IP_Hdr class will
``delete`` the pointer in its destructor, otherwise it won't.
IMHO this is a very dangerous behavior, since it's very easy to pass the
"wrong" pointer to the constructor. We should probably change the
constructor to explicitly require a flag indicating whether the pointer
should be ``delete``'ed upon destruction.
--
Ticket URL: <http://tracker.bro-ids.org/bro/ticket/532>
Bro Tracker <http://tracker.bro-ids.org/bro>
Bro Issue Tracker
More information about the bro-dev
mailing list