[svn] commit: r2578 - /trunk/src/bin/auth/asio_link.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jul 22 07:02:30 UTC 2010


Author: jinmei
Date: Thu Jul 22 07:02:30 2010
New Revision: 2578

Log:
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)

Modified:
    trunk/src/bin/auth/asio_link.cc

Modified: trunk/src/bin/auth/asio_link.cc
==============================================================================
--- trunk/src/bin/auth/asio_link.cc (original)
+++ trunk/src/bin/auth/asio_link.cc Thu Jul 22 07:02:30 2010
@@ -483,7 +483,15 @@
     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());




More information about the bind10-changes mailing list