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
- is duplicated by
-
FTPSERVER-376 [FindBugs] Possible null pointer dereference of passivePorts in PassivePorts::<init>
- Closed