Changeset 761 for trunk/pdns/pdns/dnsparser.cc
- Timestamp:
- 04/22/06 17:30:35 (4 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/dnsparser.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/dnsparser.cc
r760 r761 189 189 copy(packet+sizeof(dnsheader), packet+len, d_content.begin()); 190 190 191 unsigned int n ;191 unsigned int n=0; 192 192 193 193 PacketReader pr(d_content); … … 235 235 } 236 236 catch(out_of_range &re) { 237 if(!(validPacket && d_header.tc)) // don't sweat it over truncated packets 237 if(validPacket && d_header.tc) { // don't sweat it over truncated packets, but do adjust an, ns and arcount 238 if(n < d_header.ancount) { 239 d_header.ancount=n; d_header.nscount = d_header.arcount = 0; 240 } 241 else if(n < d_header.ancount + d_header.nscount) { 242 d_header.nscount = n - d_header.ancount; d_header.arcount=0; 243 } 244 else { 245 d_header.arcount = n - d_header.ancount - d_header.nscount; 246 } 247 } 248 else { 238 249 throw MOADNSException("Error parsing packet of "+lexical_cast<string>(len)+" bytes (rd="+ 239 250 lexical_cast<string>(d_header.rd)+ 240 251 "), out of bounds: "+string(re.what())); 252 } 241 253 } 242 254 }