From: Andrei Tatar Date: Wed, 25 Sep 2024 14:23:19 +0000 (+0200) Subject: lib/posix-unixsocket: Fix NULL crash on accept X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=12072b5fa6ef8577fc81b2ab17553a852d99a9a2;p=unikraft%2Funikraft.git lib/posix-unixsocket: Fix NULL crash on accept 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 Approved-by: Sergiu Moga Reviewed-by: Sergiu Moga GitHub-Closes: #1593 --- diff --git a/lib/posix-unixsocket/unixsock.c b/lib/posix-unixsocket/unixsock.c index b279a9b55..559c80b9b 100644 --- a/lib/posix-unixsocket/unixsock.c +++ b/lib/posix-unixsocket/unixsock.c @@ -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; }