File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,11 @@ bool CNetAddr::IsValid() const
437
437
return false ;
438
438
}
439
439
440
+ // CJDNS addresses always start with 0xfc
441
+ if (IsCJDNS () && (m_addr[0 ] != 0xFC )) {
442
+ return false ;
443
+ }
444
+
440
445
// documentation IPv6 address
441
446
if (IsRFC3849 ())
442
447
return false ;
Original file line number Diff line number Diff line change @@ -604,6 +604,16 @@ BOOST_AUTO_TEST_CASE(cnetaddr_unserialize_v2)
604
604
BOOST_CHECK_EQUAL (addr.ToString (), " fc00:1:2:3:4:5:6:7" );
605
605
BOOST_REQUIRE (s.empty ());
606
606
607
+ // Invalid CJDNS, wrong prefix.
608
+ s << MakeSpan (ParseHex (" 06" // network type (CJDNS)
609
+ " 10" // address length
610
+ " aa000001000200030004000500060007" // address
611
+ ));
612
+ s >> addr;
613
+ BOOST_CHECK (addr.IsCJDNS ());
614
+ BOOST_CHECK (!addr.IsValid ());
615
+ BOOST_REQUIRE (s.empty ());
616
+
607
617
// Invalid CJDNS, with bogus length.
608
618
s << MakeSpan (ParseHex (" 06" // network type (CJDNS)
609
619
" 01" // address length
You can’t perform that action at this time.
0 commit comments