Changeset 1797

Show
Ignore:
Timestamp:
04/11/07 18:16:08 (21 months ago)
Author:
aturner
Message:

no need to realloc buffer, since we've already created a MAX_SNAPLEN sized
buffer and copied the packet over. fixes #134

Note: still not really sure why this dies, I think in some situations,
realloc() is free()'ing the original ptr and creating a new one, but that
isn't being tracked (not updating *packet in tcpedit_packet()) and so I try to
realloc() that original ptr again and boom. Seems to only happen on some
versions of linux (like RH/CentOS) and not OS X, Unbuntu, etc- I guess
something to do with how glibc manages memory blocks.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/tcpedit/edit_packet.c

    r1787 r1797  
    191191             */ 
    192192        if (pkthdr->len > pkthdr->caplen) { 
    193             if ((pktdata = realloc(pktdata, pkthdr->len)) == NULL) { 
    194                 tcpedit_seterr(tcpedit, "%s", "Unable to realloc() pktdata for -F pad operation"); 
    195                 return -1; 
    196             } 
    197193            memset(pktdata + pkthdr->caplen, '\0', pkthdr->len - pkthdr->caplen); 
    198194            pkthdr->caplen = pkthdr->len;