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

                 Key: FTPSERVER-415
                 URL: https://issues.apache.org/jira/browse/FTPSERVER-415
             Project: FtpServer
          Issue Type: Bug
          Components: Core
            Reporter: Sebb


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).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to