BIND 10 trac2521, updated. 65b7adb8a1578ae6f070b9c877149d0db77aefda [2521] add 0-length check to DHCID from-wire constructor
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue May 7 22:12:09 UTC 2013
The branch, trac2521 has been updated
via 65b7adb8a1578ae6f070b9c877149d0db77aefda (commit)
from dac1394a30be534559eda0cfeaa140eace9000a6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 65b7adb8a1578ae6f070b9c877149d0db77aefda
Author: Paul Selkirk <pselkirk at isc.org>
Date: Tue May 7 18:12:00 2013 -0400
[2521] add 0-length check to DHCID from-wire constructor
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/rdata/in_1/dhcid_49.cc | 11 ++++-------
src/lib/dns/tests/rdata_dhcid_unittest.cc | 4 ++++
2 files changed, 8 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/rdata/in_1/dhcid_49.cc b/src/lib/dns/rdata/in_1/dhcid_49.cc
index 2cfa522..184866c 100644
--- a/src/lib/dns/rdata/in_1/dhcid_49.cc
+++ b/src/lib/dns/rdata/in_1/dhcid_49.cc
@@ -55,13 +55,6 @@ DHCID::constructFromLexer(MasterLexer& lexer) {
/// \brief Constructor from string.
///
/// \param dhcid_str A base-64 representation of the DHCID binary data.
-/// RFC4701 says "DNS software should consider the RDATA section to be opaque."
-///
-/// It is okay for the key data to be missing. Note: BIND 9 also accepts
-/// DHCID missing key data. While the RFC is silent in this case, and it
-/// may be debatable what an implementation should do, but since this field
-/// is algorithm dependent and this implementations doesn't reject unknown
-/// algorithms, it's lenient here.
///
/// \throw InvalidRdataText if the string could not be parsed correctly.
DHCID::DHCID(const std::string& dhcid_str) {
@@ -102,6 +95,10 @@ DHCID::DHCID(MasterLexer& lexer, const Name*,
/// \param buffer A buffer storing the wire format data.
/// \param rdata_len The length of the RDATA in bytes
DHCID::DHCID(InputBuffer& buffer, size_t rdata_len) {
+ if (rdata_len == 0) {
+ isc_throw(InvalidRdataLength, "Missing DHCID rdata");
+ }
+
digest_.resize(rdata_len);
buffer.readData(&digest_[0], rdata_len);
}
diff --git a/src/lib/dns/tests/rdata_dhcid_unittest.cc b/src/lib/dns/tests/rdata_dhcid_unittest.cc
index 90f44dc..77baccd 100644
--- a/src/lib/dns/tests/rdata_dhcid_unittest.cc
+++ b/src/lib/dns/tests/rdata_dhcid_unittest.cc
@@ -107,6 +107,10 @@ TEST_F(Rdata_DHCID_Test, createFromWire) {
EXPECT_EQ(0, rdata_dhcid.compare(
*rdataFactoryFromFile(RRType("DHCID"), RRClass("IN"),
"rdata_dhcid_fromWire")));
+
+ InputBuffer buffer(NULL, 0);
+ EXPECT_THROW(in::DHCID(buffer, 0), InvalidRdataLength);
+
// TBD: more tests
}
More information about the bind10-changes
mailing list