Ignore:
Timestamp:
12/19/07 11:17:58 (5 years ago)
Author:
spa1
Message:
  • Fixed get_payload_from_X functions not returning NULL in cases where they have a full X header but no subsequent payload (i.e. remaining would be exactly 0 upon return)
  • trace_get_layer3 should not be a SIMPLE_FUNCTION anymore
  • trace_get_ip now checks that at least a full IPv4 header is present
  • Calls to payload_from_ethernet functions inside trace_get_layer3 will now update remaining correctly
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/protocols_transport.c

    r1279 r1314  
    1919        transport = trace_get_layer3(packet,&ethertype,remaining); 
    2020 
    21         if (!transport) 
     21        if (!transport || *remaining == 0) 
    2222                return NULL; 
    2323 
     
    118118{ 
    119119        if (remaining) { 
    120                 if (*remaining < sizeof(libtrace_udp_t)) 
     120                if (*remaining <= sizeof(libtrace_udp_t)) 
    121121                        return NULL; 
    122122                *remaining-=sizeof(libtrace_udp_t); 
     
    129129        unsigned int dlen = tcp->doff*4; 
    130130        if (remaining) { 
    131                 if (*remaining < dlen) 
     131                if (*remaining <= dlen) 
    132132                        return NULL; 
    133133                *remaining-=dlen; 
     
    139139{ 
    140140        if (remaining) { 
    141                 if (*remaining < sizeof(libtrace_icmp_t)) 
     141                if (*remaining <= sizeof(libtrace_icmp_t)) 
    142142                        return NULL; 
    143143                *remaining-=sizeof(libtrace_icmp_t); 
Note: See TracChangeset for help on using the changeset viewer.