The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f262601ebaffafa4d258844071e16a63fb5eb43d
commit f262601ebaffafa4d258844071e16a63fb5eb43d Author: Rick Macklem <[email protected]> AuthorDate: 2025-10-27 14:49:32 +0000 Commit: Rick Macklem <[email protected]> CommitDate: 2025-10-30 01:21:44 +0000 nfs_clrpcops.c: Check for too large a write reply The "rlen" reply length for a Write operation/RPC could cause trouble if a broken server replies with too large a value. Improve the sanity check for "rlen" to avoid this. (cherry picked from commit 2c82cdd2e29f8ba00d4289f36f8baa1598a1ad9b) --- sys/fs/nfsclient/nfs_clrpcops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index bc8611f4c119..c5483623a9a5 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -2208,7 +2208,7 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iomode, NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED + NFSX_VERF); rlen = fxdr_unsigned(int, *tl++); - if (rlen == 0) { + if (rlen <= 0 || rlen > len) { error = NFSERR_IO; goto nfsmout; } else if (rlen < len) { @@ -7128,7 +7128,7 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED + NFSX_VERF); rlen = fxdr_unsigned(int, *tl++); NFSCL_DEBUG(4, "nfsrpc_writeds: len=%d rlen=%d\n", len, rlen); - if (rlen == 0) { + if (rlen <= 0 || rlen > len) { error = NFSERR_IO; goto nfsmout; } else if (rlen < len) {
