]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ICMPv6: fix RPL DAGID printing (GH #418)
authorDenis Ovsienko <[email protected]>
Sat, 3 Jan 2015 07:24:12 +0000 (07:24 +0000)
committerDenis Ovsienko <[email protected]>
Sat, 3 Jan 2015 07:29:12 +0000 (07:29 +0000)
Allow an extra byte in the buffer for snprintf()'s null character,
otherwise it does not work as intended (issue spotted by Gisle Vanem on
Windows, where snprintf() behaviour seems to be different). Update the
tests.

print-icmp6.c
tests/rpl-14-daovvv.out
tests/rpl-19-pickdag.out
tests/rpl-19-pickdagvvv.out

index 553bb46ee23a891e9c0232e8565557e39376be0f..81563e6c81389308823b0de6a916cf973ca5ea8e 100644 (file)
@@ -660,7 +660,7 @@ rpl_format_dagid(char dagid_str[65], const u_char *dagid)
                 if(isprint(dagid[i])) {
                         *d++ = dagid[i];
                 } else {
-                        snprintf(d,4,"0x%02x", dagid[i]);
+                        snprintf(d,5,"0x%02x", dagid[i]); /* 4 + null char */
                         d += 4;
                 }
         }
index bca04262bacc6ee30e5cd973f8df43e47ee9ceb1..7869e6bf7f4562c8f19bf11023b00b1b5c7ab6b1 100644 (file)
@@ -1 +1 @@
-IP6 (hlim 64, next-header ICMPv6 (58) payload length: 24) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:pandora is fun0x0,seq:1,instance:1,Dagid,40]
+IP6 (hlim 64, next-header ICMPv6 (58) payload length: 24) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:pandora is fun0x0al,seq:1,instance:1,Dagid,40]
index e4aad2312dd53a6a4f27e1c919c7e0881df3462a..2460ada4fa87a8ac7fd613a333320f68134c324a 100644 (file)
@@ -1 +1 @@
-IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x0,seq:10,instance:42,Dagid,40] opt:rpltarget len:25  opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0
+IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x000x000x000x000x000x000x000x000x000x000x000x000x000x00,seq:10,instance:42,Dagid,40] opt:rpltarget len:25  opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0
index c7dc6b5efaa4da1528a7d6372015d05b9fd83d7e..bd934537dc810998a9db95441730dc4324431e90 100644 (file)
@@ -1 +1 @@
-IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x0,seq:10,instance:42,Dagid,40] opt:rpltarget len:25  0x0000:  0080 2001 0db8 0001 0000 0216 3eff fe11 0x0010:  3424 0000 0000 00 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0
+IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x000x000x000x000x000x000x000x000x000x000x000x000x000x00,seq:10,instance:42,Dagid,40] opt:rpltarget len:25  0x0000:  0080 2001 0db8 0001 0000 0216 3eff fe11 0x0010:  3424 0000 0000 00 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0