void DNSName::throwSafeRangeError(const std::string& msg, const char* buf, size_t length)
{
std::string dots;
- if (length > maxDNSNameLength) {
- length = maxDNSNameLength;
+ if (length > s_maxDNSNameLength) {
+ length = s_maxDNSNameLength;
dots = "...";
}
std::string label;
if(labellen > 63)
throwSafeRangeError("label too long to append: ", p, length);
- if(iter-pbegin > static_cast<ptrdiff_t>(maxDNSNameLength - 1)) // reserve two bytes, one for length and one for the root label
+ if(iter-pbegin > static_cast<ptrdiff_t>(s_maxDNSNameLength - 1)) // reserve two bytes, one for length and one for the root label
throwSafeRangeError("name too long to append: ", p, length);
d_storage[lenpos]=labellen;
}
else {
d_storage=segmentDNSNameRaw(p, length);
- if(d_storage.size() > maxDNSNameLength) {
+ if(d_storage.size() > s_maxDNSNameLength) {
throwSafeRangeError("name too long: ", p, length);
}
}
throw std::range_error("no such thing as an empty label to append");
if(length > 63)
throw std::range_error("label too long to append");
- if(d_storage.size() + length > maxDNSNameLength - 1) // reserve one byte for the label length
+ if(d_storage.size() + length > s_maxDNSNameLength - 1) // reserve one byte for the label length
throw std::range_error("name too long to append");
if(d_storage.empty()) {
throw std::range_error("no such thing as an empty label to prepend");
if(label.size() > 63)
throw std::range_error("label too long to prepend");
- if(d_storage.size() + label.size() > maxDNSNameLength - 1) // reserve one byte for the label length
+ if(d_storage.size() + label.size() > s_maxDNSNameLength - 1) // reserve one byte for the label length
throw std::range_error("name too long to prepend");
if(d_storage.empty())
class DNSName
{
public:
- static const size_t maxDNSNameLength = 255;
+ static const size_t s_maxDNSNameLength = 255;
DNSName() {} //!< Constructs an *empty* DNSName, NOT the root!
// Work around assertion in some boost versions that do not like self-assignment of boost::container::string
}
DNSName& operator+=(const DNSName& rhs)
{
- if(d_storage.size() + rhs.d_storage.size() > maxDNSNameLength + 1) // one extra byte for the second root label
+ if(d_storage.size() + rhs.d_storage.size() > s_maxDNSNameLength + 1) // one extra byte for the second root label
throwSafeRangeError("resulting name too long", rhs.d_storage.data(), rhs.d_storage.size());
if(rhs.empty())
return *this;