git: 9c766ce61064 - stable/14 - 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:54:38 UTC
The branch stable/14 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=9c766ce61064ad6e2968ba918dcdb80b2c6d1a75

commit 9c766ce61064ad6e2968ba918dcdb80b2c6d1a75
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:52:52 +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 99fdeef8fe23..611036db1032 100644
--- a/sys/xdr/xdr_mbuf.c
+++ b/sys/xdr/xdr_mbuf.c
@@ -148,7 +148,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);