git: 0ecd86d21057 - stable/15 - rpc.tlsservd.c: Check the malloc return
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 23 Nov 2026 00:50:22 UTC
The branch stable/15 has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=0ecd86d21057f7a0089359d8f2753be1f2ba1e15
commit 0ecd86d21057f7a0089359d8f2753be1f2ba1e15
Author: Osvaldo Janeri Filho <ojanerif_amd.com>
AuthorDate: 2026-10-31 03:04:10 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-11-23 00:48:39 +0000
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.
(cherry picked from commit 6d705f2bf17f2c221ffd0d9b0824ba0fb429392e)
---
usr.sbin/rpc.tlsservd/rpc.tlsservd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/usr.sbin/rpc.tlsservd/rpc.tlsservd.c b/usr.sbin/rpc.tlsservd/rpc.tlsservd.c
index fb0501b2db4c..40dbb7c4ff2b 100644
--- a/usr.sbin/rpc.tlsservd/rpc.tlsservd.c
+++ b/usr.sbin/rpc.tlsservd/rpc.tlsservd.c
@@ -365,6 +365,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);