rpc.tlsservd.c: Check the malloc return

The NULL return is used by the following memcpy()
call.  Fail the request instead.

Unlikely to happen in practice, since the rpc.tlsservd
daemon runs as root and does not allocate a lot or memory.

Reviewed by:	rmacklem
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D60927
This commit is contained in:
Osvaldo Janeri Filho authored and Rick Macklem committed 2026-10-30 20:04:10 -07:00
1 parent 9b8bc7b827
commit 6d705f2bf1
1 file changed
+2
+2
View File
@@ -358,6 +358,8 @@ rpctlssd_connect_2_svc(struct rpctlssd_connect_arg *argp,
assert(rqstp->rq_xprt == xprt);
ctx = malloc(sizeof(*ctx));
if (ctx == NULL)
return (FALSE);
memcpy(&ctx->arg, argp, sizeof(ctx->arg));
ctx->xid = *(uint32_t *)pthread_getspecific(xidkey);