From 527dd946ef2dea3f1594ed549ec7f74d8c3b52a3 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Tue, 16 Feb 2016 10:58:11 +0100 Subject: [PATCH] check invalid values for ExternalPort --- miniupnpd/upnpsoap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/miniupnpd/upnpsoap.c b/miniupnpd/upnpsoap.c index f0edac9..8ae1928 100644 --- a/miniupnpd/upnpsoap.c +++ b/miniupnpd/upnpsoap.c @@ -675,6 +675,12 @@ GetSpecificPortMappingEntry(struct upnphttp * h, const char * action, const char #endif eport = (unsigned short)atoi(ext_port); + if(eport == 0) + { + ClearNameValueList(&data); + SoapError(h, 402, "Invalid Args"); + return; + } /* TODO : add r_host as an input parameter ... * We prevent several Port Mapping with same external port @@ -758,6 +764,12 @@ DeletePortMapping(struct upnphttp * h, const char * action, const char * ns) #endif /* SUPPORT_REMOTEHOST */ eport = (unsigned short)atoi(ext_port); + if(eport == 0) + { + ClearNameValueList(&data); + SoapError(h, 402, "Invalid Args"); + return; + } syslog(LOG_INFO, "%s: external port: %hu, protocol: %s", action, eport, protocol);