Commit b099d028 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[trac117] fixed a bug of from text factory: it rejected flags > 0xf (it should be > 0xff)

parent ccdb524e
......@@ -71,7 +71,7 @@ NSEC3::NSEC3(const string& nsec3_str) :
if (iss.bad() || iss.fail()) {
isc_throw(InvalidRdataText, "Invalid NSEC3 text: " << nsec3_str);
}
if (hashalg > 0xf) {
if (hashalg > 0xff) {
isc_throw(InvalidRdataText,
"NSEC3 hash algorithm out of range: " << hashalg);
}
......
......@@ -46,6 +46,18 @@ public:
string nsec3_txt;
};
TEST_F(Rdata_NSEC3_Test, fromText) {
// A normal case: the test constructor should successfully parse the
// text and construct nsec3_txt. It will be tested against the wire format
// representation in the createFromWire test.
// Numeric parameters have possible maximum values. Unusual, but must
// be accepted.
EXPECT_NO_THROW(generic::NSEC3("255 255 65535 D399EAAB "
"H9RSFB7FPF2L8HG35CMPC765TDK23RP6 "
"NS SOA RRSIG DNSKEY NSEC3PARAM"));
}
TEST_F(Rdata_NSEC3_Test, toText) {
const generic::NSEC3 rdata_nsec3(nsec3_txt);
EXPECT_EQ(nsec3_txt, rdata_nsec3.toText());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment