Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
00b804d7
Commit
00b804d7
authored
Feb 16, 2011
by
JINMEI Tatuya
Browse files
[trac117] added a test case with empty hash. code had a bug, so fixed it.
parent
75cd27c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/lib/dns/rdata/generic/nsec3_50.cc
View file @
00b804d7
...
...
@@ -163,8 +163,8 @@ NSEC3::NSEC3(InputBuffer& buffer, size_t rdata_len) {
const
uint8_t
nextlen
=
buffer
.
readUint8
();
--
rdata_len
;
if
(
rdata_len
<=
nextlen
)
{
isc_throw
(
DNSMessageFORMERR
,
"NSEC3 hash length
is too large
: "
<<
if
(
nextlen
==
0
||
rdata_len
<=
nextlen
)
{
isc_throw
(
DNSMessageFORMERR
,
"NSEC3
invalid
hash length: "
<<
static_cast
<
unsigned
int
>
(
nextlen
));
}
...
...
src/lib/dns/tests/rdata_nsec3_unittest.cc
View file @
00b804d7
...
...
@@ -153,6 +153,11 @@ TEST_F(Rdata_NSEC3_Test, createFromWire) {
"rdata_nsec3_fromWire12.wire"
),
DNSMessageFORMERR
);
// empty hash. invalid.
EXPECT_THROW
(
rdataFactoryFromFile
(
RRType
::
NSEC3
(),
RRClass
::
IN
(),
"rdata_nsec3_fromWire14.wire"
),
DNSMessageFORMERR
);
//
// Short buffer cases. The data is valid NSEC3 RDATA, but the buffer
// is trimmed at the end. All cases should result in an exception from
...
...
src/lib/dns/tests/testdata/Makefile.am
View file @
00b804d7
...
...
@@ -14,6 +14,7 @@ BUILT_SOURCES += rdata_nsec3_fromWire6.wire rdata_nsec3_fromWire7.wire
BUILT_SOURCES
+=
rdata_nsec3_fromWire8.wire rdata_nsec3_fromWire9.wire
BUILT_SOURCES
+=
rdata_nsec3_fromWire10.wire rdata_nsec3_fromWire11.wire
BUILT_SOURCES
+=
rdata_nsec3_fromWire12.wire rdata_nsec3_fromWire13.wire
BUILT_SOURCES
+=
rdata_nsec3_fromWire14.wire
BUILT_SOURCES
+=
rdata_rrsig_fromWire2.wire
BUILT_SOURCES
+=
rdata_soa_toWireUncompressed.wire
BUILT_SOURCES
+=
rdata_txt_fromWire2.wire rdata_txt_fromWire3.wire
...
...
@@ -62,6 +63,7 @@ EXTRA_DIST += rdata_nsec3_fromWire6.spec rdata_nsec3_fromWire7.spec
EXTRA_DIST
+=
rdata_nsec3_fromWire8.spec rdata_nsec3_fromWire9.spec
EXTRA_DIST
+=
rdata_nsec3_fromWire10.spec rdata_nsec3_fromWire11.spec
EXTRA_DIST
+=
rdata_nsec3_fromWire12.spec rdata_nsec3_fromWire13.spec
EXTRA_DIST
+=
rdata_nsec3_fromWire14.spec
EXTRA_DIST
+=
rdata_opt_fromWire rdata_rrsig_fromWire1
EXTRA_DIST
+=
rdata_rrsig_fromWire2.spec
EXTRA_DIST
+=
rdata_soa_fromWire rdata_soa_toWireUncompressed.spec
...
...
src/lib/dns/tests/testdata/gen-wiredata.py.in
View file @
00b804d7
...
...
@@ -361,7 +361,9 @@ class NSEC3(NSECBASE):
' ' if len(self.salt) > 0 else '',
encode_string(self.salt)))
f.write("# Hash Len=%d, Hash='%s'\n" % (self.hashlen, self.hash))
f.write('%02x %s\n' % (self.hashlen, encode_string(self.hash)))
f.write('%02x%s%s\n' % (self.hashlen,
' ' if len(self.hash) > 0 else '',
encode_string(self.hash)))
class RRSIG:
rdlen = -1 # auto-calculate
...
...
src/lib/dns/tests/testdata/rdata_nsec3_fromWire14.spec
0 → 100644
View file @
00b804d7
#
# An invalid NSEC3 RDATA: empty hash
#
[custom]
sections: nsec3
[nsec3]
hashlen: 0
hash: ''
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment