git: 6d705f2bf17f - main - rpc.tlsservd.c: Check the malloc return
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 31 Oct 2026 03:06:33 UTC
The branch main has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=6d705f2bf17f2c221ffd0d9b0824ba0fb429392e
commit 6d705f2bf17f2c221ffd0d9b0824ba0fb429392e
Author: Osvaldo Janeri Filho <ojanerif_amd.com>
AuthorDate: 2026-10-31 03:04:10 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-10-31 03:04:10 +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.
Reviewed by: rmacklem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D60927
---
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 f07385a2baa7..9826810d605b 100644
--- a/usr.sbin/rpc.tlsservd/rpc.tlsservd.c
+++ b/usr.sbin/rpc.tlsservd/rpc.tlsservd.c
@@ -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);