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

[2389] revised exception msg in case of unexpected nul character.

also added commments about the intent.
parent ec7c5400
......@@ -42,8 +42,12 @@ using namespace isc::util;
namespace {
void
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().
if (src_len != strlen(src)) {
isc_throw(InvalidRdataText, "Bad IN/A RDATA text: extra character: '"
isc_throw(InvalidRdataText,
"Bad IN/A RDATA text: unexpected nul in string: '"
<< src << "'");
}
const int result = inet_pton(AF_INET, src, dst);
......
......@@ -40,9 +40,11 @@ using namespace isc::util;
namespace {
void
convertToIPv6Addr(const char* src, size_t src_len, void* dst) {
// See a_1.cc for this check.
if (src_len != strlen(src)) {
isc_throw(InvalidRdataText, "Bad IN/AAAA RDATA text: "
"extra character: '" << src << "'");
isc_throw(InvalidRdataText,
"Bad IN/AAAA RDATA text: unexpected nul in string: '"
<< src << "'");
}
const int result = inet_pton(AF_INET6, src, dst);
if (result == 0) {
......
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