mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 18:08:12 +00:00
Kernel: Stop treating port 0 (ephemeral auto bind) as a privileged port
Binding to port 0 is used to signal to listen() to bind to any port that is available. (in serenity's case, to the port range of 32768 to 60999, which are not privileged ports)
This commit is contained in:
parent
152c54a00a
commit
dbc13e1ea2
1 changed files with 1 additions and 1 deletions
|
@ -112,7 +112,7 @@ KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t addr
|
|||
|
||||
auto requested_local_port = ntohs(address.sin_port);
|
||||
if (!Process::current()->is_superuser()) {
|
||||
if (requested_local_port < 1024) {
|
||||
if (requested_local_port > 0 && requested_local_port < 1024) {
|
||||
dbgln("UID {} attempted to bind {} to port {}", Process::current()->uid(), class_name(), requested_local_port);
|
||||
return EACCES;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue