Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1262432

Socket classes don't check the range of port numbers

    XMLWordPrintable

Details

    • 1.1
    • sparc
    • generic
    • Not verified

    Description

      The java.net Socket classes don't check the range of the
      given port number for many of the calls (bind, connect, etc.)

      Currently any valid int will be accepted as a port number. The
      socket.c natives automatically cast this down to 16 bits so everything
      appears to work okay. But on Kona, we don't do that.

      The Socket classes should probably do the checks up front and
      throw IllegalArgumentException if there is a problem.

      I noticed this bug as a symptom of the Chat service not working
      on Kona (see bug 1262417). The Chat code uses port numbers
      that are way outside of the legal range:

          static final int SERVER_SOCK_MAIN_PORT = 70196;
          static final int SERVER_HTTP_MAIN_PORT = 70496;

      sritchie -- 6 Aug 96

      The description field as copied from bug report 1262417 follows:

      The JavaSoft chat program that was tried out recently was reported not to
      run on Kona in "socket mode". There are two modes: direct socket connections
      (fastest) and "http mode" (for those behind a firewall).

      The reports were that socket mode did not work at all. Some users reported
      success and some failure using http mode.

      The urls as handed out were:

      http://hubcap.eng/finalChat/client/TestHttp.html
      and
      http://hubcap.eng/finalChat/client/TestSock.html


      [a 6 Aug 96]

      I couldn't find the above docs on the given server, but

      http://hubcap/Forum/TestSock.html
      http://hubcap/Forum/TestHttp.html

      does exist, so I experimented with those.

      sritchie -- 6 Aug 96

      Attachments

        Activity

          People

            busersunw Btplusnull User (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: