]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/posix-unixsocket: Fix NULL crash on accept
authorAndrei Tatar <andrei@unikraft.io>
Wed, 25 Sep 2024 14:23:19 +0000 (16:23 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Tue, 25 Feb 2025 09:38:40 +0000 (09:38 +0000)
This change fixes a NULL deref when accept() is handed a legal NULL
argument for addr, in which case it should not attempt to output.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
GitHub-Closes: #1593

lib/posix-unixsocket/unixsock.c

index b279a9b55d8a7ef36cb37437fae6c176b0c09daf..559c80b9b9acd98beed4483ad888da3ab4a07924 100644 (file)
@@ -394,7 +394,8 @@ void *unix_socket_accept4(posix_sock *file,
        acc->remote = data->listen.q[i].remote;
        acc->flags |= UNIXSOCK_CONN;
 
-       unix_sock_remotename(acc->remote, addr, addr_len);
+       if (addr)
+               unix_sock_remotename(acc->remote, addr, addr_len);
        return acc;
 }