InetAddress.getHostByName allows bad IP addresses

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 1.4.0
    • Affects Version/s: 1.2.2
    • Component/s: core-libs
    • beta
    • x86
    • windows_nt



      Name: rlT66838 Date: 03/13/2000


      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      InetAddress.getByName doesn't throw UnknownHostException when it should. For
      example, it happily accepts "999.999.999.999" as a valid IP address, although
      it appears to store each byte modulo 256, in this case 231.231.231.231. The
      following code can be used to verify this behavior.


      import java.net.*;
      import java.io.*;

      public class InetTest
      {
        public static void main (String[] args)
        {
          try {
            InetAddress ip = InetAddress.getByName (args[0]);
            System.out.println ("IP address = " + ip.getHostAddress());
          }
          catch (UnknownHostException e) {
            System.out.println ("Bad IP address");
          }
        }
      }
      (Review ID: 102411)
      ======================================================================

            Assignee:
            Alan Bateman
            Reporter:
            Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: