Commit 25e8db65 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

cleanup:

 avoided using a hardocded magic number
 simplified RRType construction


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1076 e5f2f494-b856-4b98-b285-d166d9295462
parent 7a803a47
......@@ -39,6 +39,15 @@ using namespace std;
// BEGIN_ISC_NAMESPACE
// BEGIN_RDATA_NAMESPACE
namespace {
// This is the minimum necessary length of all wire-format RRSIG RDATA:
// - two 8-bit fields (algorithm and labels)
// - two 16-bit fields (covered and tag)
// - three 32-bit fields (original TTL, expire and inception)
const size_t RRSIG_MINIMUM_LEN = 2 * sizeof(uint8_t) + 2 * sizeof(uint16_t) +
3 * sizeof(uint32_t);
}
struct RRSIGImpl {
// straightforward representation of RRSIG RDATA fields
RRSIGImpl(const RRType& covered, uint8_t algorithm, uint8_t labels,
......@@ -100,12 +109,11 @@ RRSIG::RRSIG(InputBuffer& buffer, size_t rdata_len)
{
size_t pos = buffer.getPosition();
if (rdata_len < 18) {
if (rdata_len < RRSIG_MINIMUM_LEN) {
dns_throw(InvalidRdataLength, "RRSIG too short");
}
uint16_t typecode = buffer.readUint16();
RRType covered(typecode);
RRType covered(buffer);
uint8_t algorithm = buffer.readUint8();
uint8_t labels = buffer.readUint8();
uint32_t originalttl = buffer.readUint32();
......
Supports Markdown
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