From 57ae40fe108d956ca5a0770f03aefac2922a40e8 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 28 Jan 2023 15:49:53 +0100 Subject: [PATCH] miniupnpd: reject AddPinhole when InternalPort or RemortePort is empty https://miniupnp.tuxfamily.org/forum/viewtopic.php?p=5839 --- miniupnpd/upnpsoap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/miniupnpd/upnpsoap.c b/miniupnpd/upnpsoap.c index fb4b70e..0d0181c 100644 --- a/miniupnpd/upnpsoap.c +++ b/miniupnpd/upnpsoap.c @@ -1666,6 +1666,14 @@ AddPinhole(struct upnphttp * h, const char * action, const char * ns) protocol = GetValueFromNameValueList(&data, "Protocol"); leaseTime = GetValueFromNameValueList(&data, "LeaseTime"); +#ifdef UPNP_STRICT + if (rem_port == NULL || rem_port[0] == '\0' || int_port == NULL || int_port[0] == '\0' ) + { + ClearNameValueList(&data); + SoapError(h, 402, "Invalid Args"); + return; + } +#endif rport = (unsigned short)(rem_port ? atoi(rem_port) : 0); iport = (unsigned short)(int_port ? atoi(int_port) : 0); ltime = leaseTime ? atoi(leaseTime) : -1;