Error returned by UPnPContext::getAvailablePortNumber not handled correctly
View options
- Truncate descriptions
The UPnPContext::getAvailablePortNumber
function returns 0 if it can't find an available port number, but this case isn't handled correctly in the following two functions:
-
UPnPContext::provisionNewMappings
simply callsgetAvailablePortNumber
again whenever this happens, which can lead to an infinite loop; -
UPnPContext::registerMapping
doesn't check whether the port number it got is zero or not, so it will go ahead and request a port mapping with internal and external port numbers set to 0, which is invalid.