src/net/dns/record_rdata_unittest.cc
// Test that an address_set extension missing a length field
// is correctly rejected.
Test that an address_set extension missing a length field
is correctly rejected.
Test that an address_set extension missing a length field is correctly rejected .
TEST(RecordRdataTest, EsniMalformedRecord_MalformedAddressSetLength) {
  char record[10000] = {};
  base::BigEndianWriter writer(record, sizeof(record));
  AppendWellFormedEsniKeys(&writer);
  writer.WriteU16(3);  
  writer.WriteU16(EsniRecordRdata::kAddressSetExtensionType);
  writer.WriteU8(57);
  auto record_size = writer.ptr() - record;
  DnsRecordParser parser(record, record_size, 0 );
  std::unique_ptr<EsniRecordRdata> record_obj =
      EsniRecordRdata::Create(std::string(record, record_size), parser);
  ASSERT_THAT(record_obj, IsNull());
}
TEST ( RecordRdataTest , EsniMalformedRecord_MalformedAddressSetLength ) { char record [ 10000 ] = { } ; base :: BigEndianWriter writer ( record , sizeof ( record ) ) ; AppendWellFormedEsniKeys ( & writer ) ; writer . WriteU16 ( 3 ) ; writer . WriteU16 ( EsniRecordRdata :: kAddressSetExtensionType ) ; writer . WriteU8 ( 57 ) ; auto record_size = writer . ptr ( ) - record ; DnsRecordParser parser ( record , record_size , 0 ) ; std :: unique_ptr < EsniRecordRdata > record_obj = EsniRecordRdata :: Create ( std :: string ( record , record_size ) , parser ) ; ASSERT_THAT ( record_obj , IsNull ( ) ) ; }
Test that an address_set extension missing a length field
is correctly rejected.
Test that an address_set extension missing a length field is correctly rejected .
// 3 bytes: 2 for the DNS extension type, and one for our // too-short address_set length // length of the dns_extensions field // oops! need two bytes for the address length /* offset */