]> granicus.if.org Git - pdns/commitdiff
ComboAddress truncate() is assumed to never throw. Enforce this.
authorbert hubert <bert.hubert@powerdns.com>
Wed, 18 Jan 2017 15:17:06 +0000 (16:17 +0100)
committerbert hubert <bert.hubert@powerdns.com>
Wed, 18 Jan 2017 15:17:06 +0000 (16:17 +0100)
pdns/iputils.cc
pdns/iputils.hh

index 3b7a0d10bea870a48b03aaaf94fcdf443bf40805..e31c2d367374c4f57923b286be17ac468f5c7147 100644 (file)
@@ -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;
index e51acae93a5fbddbeb0b08851b5faa32a6952fce..c4a603dc28390e369a98886ada849fa40d648ea3 100644 (file)
@@ -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 */