From: bert hubert Date: Wed, 18 Jan 2017 15:17:06 +0000 (+0100) Subject: ComboAddress truncate() is assumed to never throw. Enforce this. X-Git-Tag: rec-4.1.0-alpha1~303^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b6099b2397c1b5a4789235ad5c06ac83ecfa818;p=pdns ComboAddress truncate() is assumed to never throw. Enforce this. --- diff --git a/pdns/iputils.cc b/pdns/iputils.cc index 3b7a0d10b..e31c2d367 100644 --- a/pdns/iputils.cc +++ b/pdns/iputils.cc @@ -227,7 +227,8 @@ void fillMSGHdr(struct msghdr* msgh, struct iovec* iov, char* cbuf, size_t cbufs msgh->msg_flags = 0; } -void ComboAddress::truncate(unsigned int bits) +// warning: various parts of PowerDNS assume 'truncate' will never throw +void ComboAddress::truncate(unsigned int bits) noexcept { uint8_t* start; int len=4; diff --git a/pdns/iputils.hh b/pdns/iputils.hh index e51acae93..c4a603dc2 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -276,7 +276,7 @@ union ComboAddress { return "["+toString() + "]:" + std::to_string(ntohs(sin4.sin_port)); } - void truncate(unsigned int bits); + void truncate(unsigned int bits) noexcept; }; /** This exception is thrown by the Netmask class and by extension by the NetmaskGroup class */