Changeset 411666a
- Timestamp:
- 12/19/07 11:17:58 (13 years ago)
- 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
- Location:
- lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/libtrace.h.in
r50bbce8 r411666a 1128 1128 * bytes after the pointer returned. 1129 1129 */ 1130 DLLEXPORT SIMPLE_FUNCTION1130 DLLEXPORT 1131 1131 void *trace_get_layer3(const libtrace_packet_t *packet, 1132 1132 uint16_t *ethertype, uint32_t *remaining); -
lib/protocols_l2.c
r8f18776 r411666a 36 36 37 37 if (remaining) { 38 if (*remaining < sizeof(libtrace_8021q_t))38 if (*remaining <= sizeof(libtrace_8021q_t)) 39 39 return NULL; 40 40 … … 78 78 ethernet=(char*)ethernet+4; 79 79 if (remaining) { 80 if (*remaining< 4)80 if (*remaining<=4) 81 81 return NULL; 82 82 else … … 98 98 99 99 if (remaining) { 100 if (*remaining < sizeof(libtrace_llcsnap_t))100 if (*remaining <= sizeof(libtrace_llcsnap_t)) 101 101 return NULL; 102 102 *remaining-=(sizeof(libtrace_llcsnap_t)); … … 117 117 int8_t extra = 0; /* how many QoS bytes to skip */ 118 118 119 if (remaining && *remaining < sizeof(libtrace_80211_t))119 if (remaining && *remaining <= sizeof(libtrace_80211_t)) 120 120 return NULL; 121 121 … … 159 159 160 160 if (remaining) { 161 if (*remaining < sizeof(libtrace_ppp_t))161 if (*remaining <= sizeof(libtrace_ppp_t)) 162 162 return NULL; 163 163 *remaining-=sizeof(libtrace_ppp_t); … … 186 186 187 187 if (remaining) { 188 if (*remaining < sizeof(libtrace_chdlc_t))188 if (*remaining <= sizeof(libtrace_chdlc_t)) 189 189 return NULL; 190 190 *remaining-=sizeof(libtrace_chdlc_t); … … 253 253 { 254 254 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)) 256 256 return NULL; 257 257 cell=(libtrace_atm_capture_cell_t*)link; -
lib/protocols_l3.c
r75453c2 r411666a 16 16 return NULL; 17 17 18 /* Make sure we have at least a base IPv4 header */ 19 if (remaining < sizeof(libtrace_ip_t)) 20 return NULL; 21 18 22 /* Not an IPv4 packet */ 19 23 if (((libtrace_ip_t*)ret)->ip_v != 4) … … 50 54 51 55 if (remaining) { 52 if (*remaining< (ipptr->ip_hl*4U)) {56 if (*remaining<=(ipptr->ip_hl*4U)) { 53 57 return NULL; 54 58 } … … 135 139 136 140 link = trace_get_layer2(packet,&linktype,remaining); 137 138 141 iphdr = trace_get_payload_from_layer2( 139 142 link, … … 142 145 remaining); 143 146 144 if (!iphdr) 145 return NULL; 146 147 /* These should really update remaining */ 147 148 for(;;) { 149 if (!iphdr || *remaining == 0) 150 return NULL; 148 151 switch(*ethertype) { 149 152 case 0x8100: /* VLAN */ 150 153 iphdr=trace_get_vlan_payload_from_ethernet_payload( 151 iphdr,ethertype, NULL);154 iphdr,ethertype,remaining); 152 155 continue; 153 156 case 0x8847: /* MPLS */ 154 157 iphdr=trace_get_mpls_payload_from_ethernet_payload( 155 iphdr,ethertype, NULL);158 iphdr,ethertype,remaining); 156 159 157 160 if (iphdr && ethertype == 0x0) { 158 161 iphdr=trace_get_payload_from_ethernet( 159 iphdr,ethertype, NULL);162 iphdr,ethertype,remaining); 160 163 } 161 164 continue; … … 167 170 } 168 171 172 if (!iphdr || *remaining == 0) 173 return NULL; 169 174 /* Store values in the cache for later */ 170 175 /* Cast away constness, nasty, but this is just a cache */ 171 176 ((libtrace_packet_t*)packet)->l3_ethertype = *ethertype; 172 177 ((libtrace_packet_t*)packet)->l3_header = iphdr; 173 174 178 return iphdr; 175 179 } -
lib/protocols_pktmeta.c
r8b98289 r411666a 26 26 27 27 if (remaining) { 28 if (*remaining < sizeof(*sll))28 if (*remaining <= sizeof(*sll)) 29 29 return NULL; 30 30 *remaining-=sizeof(*sll); … … 43 43 libtrace_pflog_header_t *pflog = (libtrace_pflog_header_t*)link; 44 44 if (remaining) { 45 if (*remaining< sizeof(*pflog))45 if (*remaining<=sizeof(*pflog)) 46 46 return NULL; 47 47 *remaining-=sizeof(*pflog); … … 58 58 { 59 59 if (remaining) { 60 if (*remaining< 144)60 if (*remaining<=144) 61 61 return NULL; 62 62 *remaining-=144; … … 75 75 uint16_t rtaplen = bswap_le_to_host16(rtap->it_len); 76 76 if (remaining) { 77 if (*remaining < rtaplen)77 if (*remaining <= rtaplen) 78 78 return NULL; 79 79 *remaining -= rtaplen; -
lib/protocols_transport.c
ra81d2fc r411666a 19 19 transport = trace_get_layer3(packet,ðertype,remaining); 20 20 21 if (!transport )21 if (!transport || *remaining == 0) 22 22 return NULL; 23 23 … … 118 118 { 119 119 if (remaining) { 120 if (*remaining < sizeof(libtrace_udp_t))120 if (*remaining <= sizeof(libtrace_udp_t)) 121 121 return NULL; 122 122 *remaining-=sizeof(libtrace_udp_t); … … 129 129 unsigned int dlen = tcp->doff*4; 130 130 if (remaining) { 131 if (*remaining < dlen)131 if (*remaining <= dlen) 132 132 return NULL; 133 133 *remaining-=dlen; … … 139 139 { 140 140 if (remaining) { 141 if (*remaining < sizeof(libtrace_icmp_t))141 if (*remaining <= sizeof(libtrace_icmp_t)) 142 142 return NULL; 143 143 *remaining-=sizeof(libtrace_icmp_t);
Note: See TracChangeset
for help on using the changeset viewer.