miniupnpd: reject AddPinhole when InternalPort or RemortePort is empty

https://miniupnp.tuxfamily.org/forum/viewtopic.php?p=5839
This commit is contained in:
Thomas Bernard 2023-01-28 15:49:53 +01:00
parent 5a003a4f56
commit 57ae40fe10
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
1 changed files with 8 additions and 0 deletions

View File

@ -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;