Uploaded image for project: 'FtpServer'
  1. FtpServer
  2. FTPSERVER-415

NPE in PassivePorts(int[] passivePorts, boolean checkIfBound) constructor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0.6, 1.1.0
    • Core
    • None

    Description

      The PassivePorts(int[] passivePorts, boolean checkIfBound) constructor allows passivePorts to be null, but then uses it to create the parallel reservedPorts list:

      if (passivePorts != null)

      { this.passivePorts = passivePorts.clone(); }

      else

      { this.passivePorts = null; // sets field to null }

      reservedPorts = new boolean[passivePorts.length]; // <= possible NPE here

      If null is really allowed as a parameter, it should be handled properly.

      Either set reservedPorts to null as well, or (perhaps safer) create an empty passivePorts array (and empty reservedPorts array).

      Attachments

        Issue Links

          Activity

            People

              niklas Niklas Therning
              sebb Sebb
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: