The branch stable/13 has been updated by rmacklem:

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

commit a41216dbe060032bb439d55220bd4a8e135ec80f
Author:     Rick Macklem <rmack...@freebsd.org>
AuthorDate: 2021-12-09 22:15:48 +0000
Commit:     Rick Macklem <rmack...@freebsd.org>
CommitDate: 2021-12-23 01:36:18 +0000

    nfscl: Sanity check the callback tag length
    
    The sanity check for tag length in a callback request
    was broken in two ways:
    
    It checked for a negative value, but not a large positive
    value.
    
    It did not set taglen to -1, to indicate to the code that
    it should not be used.
    
    This patch fixes both of these issues.
    
    PR:     260266
    
    (cherry picked from commit d9931c25617d6625e280fda19bd9c2878e49c091)
---
 sys/fs/nfsclient/nfs_clstate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 08eada1e1c3e..f34b9e3e05b6 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -3533,8 +3533,9 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p)
        nfsrvd_rephead(nd);
        NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
        taglen = fxdr_unsigned(int, *tl);
-       if (taglen < 0) {
+       if (taglen < 0 || taglen > NFSV4_OPAQUELIMIT) {
                error = EBADRPC;
+               taglen = -1;
                goto nfsmout;
        }
        if (taglen <= NFSV4_SMALLSTR)

Reply via email to