From: Mukund Sivaraman Date: Tue, 18 Feb 2014 12:21:45 +0000 (+0530) Subject: [2512] Add some comments X-Git-Tag: bind10-1.2.0beta1-release~38^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d831e948945c913ac59424fa549fd7e2f18b117;p=thirdparty%2Fkea.git [2512] Add some comments --- diff --git a/src/lib/dns/rdata/generic/detail/char_string.cc b/src/lib/dns/rdata/generic/detail/char_string.cc index 16b281dae6..328fa7b406 100644 --- a/src/lib/dns/rdata/generic/detail/char_string.cc +++ b/src/lib/dns/rdata/generic/detail/char_string.cc @@ -105,7 +105,13 @@ stringToCharStringData(const MasterToken::StringRegion& str_region, int c = (*s & 0xff); if (escape && std::isdigit(c) != 0) { c = decimalToNumber(s, s_end); + // decimalToNumber() already throws if (s_end - s) is less + // than 3, so the following assertion is unnecessary. But we + // assert it anyway. 'n' is an unsigned type (size_t) and + // can underflow. assert(n >= 3); + // 'n' and 's' are also updated by 1 in the for statement's + // expression, so we update them by 2 instead of 3 here. n -= 2; s += 2; } else if (!escape && c == '\\') {