git: 00c640349654 - stable/15 - xdr_mbuf.c: Add a check for the return value for xdrmbuf_getbytes()

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Mon, 23 Nov 2026 00:49:11 UTC
The branch stable/15 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=00c640349654063dd729b1af85def3b6159c9bc2

commit 00c640349654063dd729b1af85def3b6159c9bc2
Author:     Vinicius Ferrao <ferrao@versatuphpc.com.br>
AuthorDate: 2026-11-05 23:58:56 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-11-23 00:45:41 +0000

    xdr_mbuf.c: Add a check for the return value for xdrmbuf_getbytes()
    
    The xdrmbuf_getlong() function failed to check for the return
    value from xdrmbuf_getbytes().  This could have resulted in
    a failure during NFS RPC message processing.
    
    (cherry picked from commit cf59649539e653db8285996af2b161be9693a49d)
---
 sys/xdr/xdr_mbuf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/xdr/xdr_mbuf.c b/sys/xdr/xdr_mbuf.c
index 6cb72f8fe1b4..27ff71848574 100644
--- a/sys/xdr/xdr_mbuf.c
+++ b/sys/xdr/xdr_mbuf.c
@@ -151,7 +151,8 @@ xdrmbuf_getlong(XDR *xdrs, long *lp)
 	if (p) {
 		t = *p;
 	} else {
-		xdrmbuf_getbytes(xdrs, (char *) &t, sizeof(int32_t));
+		if (!xdrmbuf_getbytes(xdrs, (char *) &t, sizeof(int32_t)))
+			return (FALSE);
 	}
 
 	*lp = ntohl(t);