tcpdump mailing list archives

Re: Problems with removing alignment stuff in IP dissector


From: Guy Harris <gharris () sonic net>
Date: Tue, 5 Nov 2002 09:49:50 -0800

On Tue, Nov 05, 2002 at 04:38:24PM +0900, Jun-ichiro itojun Hagino wrote:
So should we undo that change, or should we go through and, at minimum,
convert all 4-byte accesses to use EXTRACT_32BITS()?  (Presumably
little-endian fetches are already using EXTRACT_LE_32BITS().)
If so, I'd say we should convert 2-byte accesses to use
EXTRACT_16BITS(), just to be sure.

      we can't undo the change, the code in print-{ip,ip6,arp}.c had severe
      memory leaks.

Presumably it's something other than a leak of the buffer allocated by

        /*
         * If the IP header is not aligned, copy into abuf.
         */
        if ((long)ip & 3) {
                static u_char *abuf = NULL;
                static int didwarn = 0;

                if (abuf == NULL) {
                        abuf = (u_char *)malloc(snaplen);
                        if (abuf == NULL)
                                error("ip_print: malloc");
                }

or its IPv6 equivalent, as that should only be allocated once, unless
I'm missing something.

(Code in print-arp.c?  I don't see any memory allocation code there.)
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: