Changeset aa22b5b for lib/protocols_l3.c


Ignore:
Timestamp:
10/31/08 13:51:59 (13 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
13fd6e1
Parents:
5d4e520
Message:

If we have a complete header, but truncated at the end of it, we shouldn't return NULL from
get_payload_from_* functions so we can distinguish it from a truncated header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols_l3.c

    r530cef6 raa22b5b  
    4949        void *trans_ptr = 0;
    5050
    51         if (ipptr == NULL)
    52                 return NULL;
     51        assert(ipptr != NULL);
     52        assert(ipptr->ip_v == 4);
    5353
    5454        if ((ntohs(ipptr->ip_off) & SW_IP_OFFMASK) != 0) {
     
    5959
    6060        if (remaining) {
    61                 if (*remaining<=(ipptr->ip_hl*4U)) {
     61                if (*remaining<(ipptr->ip_hl*4U)) {
    6262                        *remaining = 0;
    6363                        return NULL;
     
    7777{
    7878        void *payload = (char*)ipptr+sizeof(libtrace_ip6_t);
    79         uint8_t nxt = ipptr->nxt;
    80 
    81         if (ipptr == NULL)
    82                 return NULL;
    83        
     79        uint8_t nxt;
     80
     81        assert (ipptr != NULL);
     82        nxt = ipptr->nxt;       
    8483        if (remaining) {
    8584                if (*remaining<sizeof(libtrace_ip6_t)) {
Note: See TracChangeset for help on using the changeset viewer.