rpc_generic.c: Fix a rpcbind core dump when rpcinfo is done

Commit c5d671b added netlink support to
server side rpcbind. However it did not add
a case for AF_NETLINK to __rpc_taddr2uaddr_af().
(Reported as PR#289625.)

As such, without this patch the r_addr field of the
netlink rbllist is NULL, which causes a crash in
svc_sendreply() for a Dump query (what rpcinfo
does).

PR:	289625
Reviewed by:	glebius
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52651
Fixes:	c5d671b711 ("libc/rpc: add userland side RPC server over netlink(4)")
This commit is contained in:
Rick Macklem
2025-09-28 07:56:17 -07:00
parent bbec2c9a6d
commit 70730cd21c
+4
View File
@@ -610,6 +610,10 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
return NULL;
break;
#endif
case AF_NETLINK:
if (asprintf(&ret, "%s", (char *)nbuf->buf) < 0)
return NULL;
break;
case AF_LOCAL:
sun = nbuf->buf;
if (asprintf(&ret, "%.*s", (int)(sun->sun_len -