Browse Source

[2389] added more notes on length validation for from-str in::A ctor

JINMEI Tatuya 12 years ago
parent
commit
27dcc01ebe
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/lib/dns/rdata/in_1/a_1.cc

+ 4 - 0
src/lib/dns/rdata/in_1/a_1.cc

@@ -45,6 +45,10 @@ convertToIPv4Addr(const char* src, size_t src_len, uint32_t* dst) {
     // This check specifically rejects invalid input that begins with valid
     // address text followed by a nul character (and possibly followed by
     // further garbage).  It cannot be detected by inet_pton().
+    //
+    // Note that this is private subroutine of the in::A constructors, which
+    // pass std::string.size() or StringRegion::len as src_len, so it should
+    // be equal to strlen() unless there's an intermediate nul character.
     if (src_len != strlen(src)) {
         isc_throw(InvalidRdataText,
                   "Bad IN/A RDATA text: unexpected nul in string: '"