Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-624

SubnetInfo#toCidrNotation - a wrong format subnet mask is allowed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 3.7
    • None
    • None

    Description

      An IPv4 subnet mask, which is also the network mask, must consist of a set of contiguous 1-bits followed by a block of 0-bits (i.e. 255.255.255.0), but it does not check.

      /* 255.255.0.1 is 11111111.11111111.00000000.00000001 in  binary */
      SubnetUtils su = new SubnetUtils("192.168.0.1", "255.255.0.1"); // expect error
      SubnetInfo si = su.getInfo();
      System.out.println(si.getNetmask()); // Expect error or 255.255.0.1
      255.255.128.0
      

      https://github.com/apache/commons-net/pull/13

      Attachments

        Activity

          People

            Unassigned Unassigned
            Umoxfo Makoto Sakaguchi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: