git: cf59649539e6 - main - xdr_mbuf.c: Add a check for the return value for xdrmbuf_getbytes()

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Fri, 06 Nov 2026 00:01:05 UTC
The branch main has been updated by rmacklem:

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

commit cf59649539e653db8285996af2b161be9693a49d
Author:     Vinicius Ferrao <ferrao@versatuphpc.com.br>
AuthorDate: 2026-11-05 23:58:56 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-11-05 23:58:56 +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.
    
    Reviewed by:    rmacklem
    MFC after:      2 weeks
    Sponsored by:   VersatusHPC
---
 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);