Browse Source

worked around another brokenness of sunstudio.
(may not be super trivial, but let me commit it to trunk to make the build/test
succeed. I'll ask a quick sanity check on jabber)


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2578 e5f2f494-b856-4b98-b285-d166d9295462

JINMEI Tatuya 15 years ago
parent
commit
c2258c4e0b
1 changed files with 9 additions and 1 deletions
  1. 9 1
      src/bin/auth/asio_link.cc

+ 9 - 1
src/bin/auth/asio_link.cc

@@ -483,7 +483,15 @@ IOServiceImpl::IOServiceImpl(AuthSrv* auth_server, const char& port,
     uint16_t portnum;
 
     try {
-        portnum = boost::lexical_cast<uint16_t>(&port);
+        // XXX: SunStudio with stlport4 doesn't reject some invalid
+        // representation such as "-1" by lexical_cast<uint16_t>, so
+        // we convert it into a signed integer of a larger size and perform
+        // range check ourselves.
+        int32_t portnum32 = boost::lexical_cast<int32_t>(&port);
+        if (portnum32 < 0 || portnum32 > 65535) {
+            isc_throw(IOError, "Invalid port number '" << &port);
+        }
+        portnum = portnum32;
     } catch (const boost::bad_lexical_cast& ex) {
         isc_throw(IOError, "Invalid port number '" << &port << "': " <<
                   ex.what());