@@ -365,3 +365,35 @@ func TestDNSMalformedPacket(t *testing.T) {
365
365
t .Errorf ("unexpected error message: %v" , err )
366
366
}
367
367
}
368
+
369
+ // testDNSMalformedPacket2 is the packet:
370
+ // 15:14:42.056054 IP 10.77.0.245.53 > 10.1.0.45.38769: 12625 zoneInit YXRRSet- [49833q],[|domain]
371
+ // 0x0000: 0055 22af c637 0022 55ac deac 0800 4500 .U"..7."U.....E.
372
+ // 0x0010: 0079 3767 4000 3911 f49d 0a4d 00f5 0a01 [email protected] ....
373
+ // 0x0020: 002d 0035 9771 0065 6377 3151 f057 c2a9 .-.5.q.ecw1Q.W..
374
+ // 0x0030: fc6e e86a beb0 f7d4 8599 373e b5f8 9db2 .n.j......7>....
375
+ // 0x0040: a399 21a1 9762 def1 def4 f5ab 5675 023e ..!..b......Vu.>
376
+ // 0x0050: c9ca 304f 178a c2ad f2fc 677a 0e4c b892 ..0O......gz.L..
377
+ // 0x0060: ab71 09bb 1ea4 f7c4 fe47 7a39 868b 29a0 .q.......Gz9..).
378
+ // 0x0070: 62c4 d184 5b4e 8817 4cc0 d1d0 d430 11d3 b...[N..L....0..
379
+ // 0x0080: d147 543f afc7 1a .GT?...
380
+ var testDNSMalformedPacket2 = []byte {
381
+ 0x00 , 0x55 , 0x22 , 0xaf , 0xc6 , 0x37 , 0x00 , 0x22 , 0x55 , 0xac , 0xde , 0xac , 0x08 , 0x00 , 0x45 , 0x00 ,
382
+ 0x00 , 0x79 , 0x37 , 0x67 , 0x40 , 0x00 , 0x39 , 0x11 , 0xf4 , 0x9d , 0x0a , 0x4d , 0x00 , 0xf5 , 0x0a , 0x01 ,
383
+ 0x00 , 0x2d , 0x00 , 0x35 , 0x97 , 0x71 , 0x00 , 0x65 , 0x63 , 0x77 , 0x31 , 0x51 , 0xf0 , 0x57 , 0xc2 , 0xa9 ,
384
+ 0xfc , 0x6e , 0xe8 , 0x6a , 0xbe , 0xb0 , 0xf7 , 0xd4 , 0x85 , 0x99 , 0x37 , 0x3e , 0xb5 , 0xf8 , 0x9d , 0xb2 ,
385
+ 0xa3 , 0x99 , 0x21 , 0xa1 , 0x97 , 0x62 , 0xde , 0xf1 , 0xde , 0xf4 , 0xf5 , 0xab , 0x56 , 0x75 , 0x02 , 0x3e ,
386
+ 0xc9 , 0xca , 0x30 , 0x4f , 0x17 , 0x8a , 0xc2 , 0xad , 0xf2 , 0xfc , 0x67 , 0x7a , 0x0e , 0x4c , 0xb8 , 0x92 ,
387
+ 0xab , 0x71 , 0x09 , 0xbb , 0x1e , 0xa4 , 0xf7 , 0xc4 , 0xfe , 0x47 , 0x7a , 0x39 , 0x86 , 0x8b , 0x29 , 0xa0 ,
388
+ 0x62 , 0xc4 , 0xd1 , 0x84 , 0x5b , 0x4e , 0x88 , 0x17 , 0x4c , 0xc0 , 0xd1 , 0xd0 , 0xd4 , 0x30 , 0x11 , 0xd3 ,
389
+ 0xd1 , 0x47 , 0x54 , 0x3f , 0xaf , 0xc7 , 0x1a ,
390
+ }
391
+
392
+ func TestDNSMalformedPacket2 (t * testing.T ) {
393
+ p := gopacket .NewPacket (testDNSMalformedPacket2 , LinkTypeEthernet , testDecodeOptions )
394
+ if errLayer := p .ErrorLayer (); errLayer == nil {
395
+ t .Error ("No error layer on invalid DNS name" )
396
+ } else if err := errLayer .Error (); ! strings .Contains (err .Error (), "offset pointer too high" ) {
397
+ t .Errorf ("unexpected error message: %v" , err )
398
+ }
399
+ }
0 commit comments