mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
[Network] Solve type mismatch in AllowPort().
Casting it to an int16_t was wrong and would preclude the check for high port numbers (due to overflow). This makes the type matching, but adds an explicit check to ensure the port number passed in is within a valid range.
This commit is contained in:
parent
88bfb5d5d1
commit
69597507db
1 changed files with 3 additions and 2 deletions
|
|
@ -1203,13 +1203,14 @@ nsIOService::SetConnectivityInternal(bool aConnectivity)
|
|||
NS_IMETHODIMP
|
||||
nsIOService::AllowPort(int32_t inPort, const char *scheme, bool *_retval)
|
||||
{
|
||||
int16_t port = inPort;
|
||||
int32_t port = inPort;
|
||||
if (port == -1) {
|
||||
*_retval = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (port == 0) {
|
||||
// Ensure the port number is within a valid range
|
||||
if (port <= 0 || port >= std::numeric_limits<uint16_t>::max()) {
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue