Changeset 411666a for lib/protocols_l2.c


Ignore:
Timestamp:
12/19/07 11:17:58 (14 years ago)
Author:
Shane Alcock <salcock@…>
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:
a78665c
Parents:
287b2b4
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
  • lib/protocols_l2.c

    r8f18776 r411666a  
    3636
    3737                if (remaining) {
    38                         if (*remaining < sizeof(libtrace_8021q_t))
     38                        if (*remaining <= sizeof(libtrace_8021q_t))
    3939                                return NULL;
    4040
     
    7878                ethernet=(char*)ethernet+4;
    7979                if (remaining) {
    80                         if (*remaining<4)
     80                        if (*remaining<=4)
    8181                                return NULL;
    8282                        else
     
    9898
    9999        if (remaining) {
    100                 if (*remaining < sizeof(libtrace_llcsnap_t))
     100                if (*remaining <= sizeof(libtrace_llcsnap_t))
    101101                        return NULL;
    102102                *remaining-=(sizeof(libtrace_llcsnap_t));
     
    117117        int8_t extra = 0; /* how many QoS bytes to skip */
    118118       
    119         if (remaining && *remaining < sizeof(libtrace_80211_t))
     119        if (remaining && *remaining <= sizeof(libtrace_80211_t))
    120120                return NULL;
    121121
     
    159159
    160160        if (remaining) {
    161                 if (*remaining < sizeof(libtrace_ppp_t))
     161                if (*remaining <= sizeof(libtrace_ppp_t))
    162162                        return NULL;
    163163                *remaining-=sizeof(libtrace_ppp_t);
     
    186186
    187187        if (remaining) {
    188                 if (*remaining < sizeof(libtrace_chdlc_t))
     188                if (*remaining <= sizeof(libtrace_chdlc_t))
    189189                        return NULL;
    190190                *remaining-=sizeof(libtrace_chdlc_t);
     
    253253{
    254254        libtrace_atm_capture_cell_t *cell;
    255         if (remaining && *remaining<sizeof(libtrace_atm_capture_cell_t))
     255        if (remaining && *remaining<=sizeof(libtrace_atm_capture_cell_t))
    256256                return NULL;
    257257        cell=(libtrace_atm_capture_cell_t*)link;
Note: See TracChangeset for help on using the changeset viewer.