Skip to content
Snippets Groups Projects
Commit 4049cc89 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Stepan Salenikovich
Browse files

upnp: fix null deferencing during mapping

Refs #68811

Change-Id: I65e63c4b2998ea1c76041e6ee24bb698715d5fca
parent 412cdcc4
No related branches found
No related tags found
No related merge requests found
......@@ -82,12 +82,13 @@ Controller::addAnyMapping(uint16_t port_desired,
Mapping mapping = upnpContext_->addAnyMapping(port_desired, port_local, type,
use_same_port, unique);
if (mapping) {
auto usedPort = mapping.getPortExternal();
if (port_used)
*port_used = mapping.getPortExternal();
*port_used = usedPort;
/* add to map */
auto& instanceMappings = type == PortType::UDP ? udpMappings_ : tcpMappings_;
instanceMappings.emplace(*port_used, std::move(mapping));
instanceMappings.emplace(usedPort, std::move(mapping));
return true;
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment