Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/nfs nfs: Avoid integer overflow in nfs_namei bounds check.



details:   https://anonhg.NetBSD.org/src/rev/1c3974da7422
branches:  trunk
changeset: 374002:1c3974da7422
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 23 19:52:42 2023 +0000

description:
nfs: Avoid integer overflow in nfs_namei bounds check.

XXX pullup-8
XXX pullup-9
XXX pullup-10

diffstat:

 sys/nfs/nfs_srvsubs.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r cfb6c5f58375 -r 1c3974da7422 sys/nfs/nfs_srvsubs.c
--- a/sys/nfs/nfs_srvsubs.c     Thu Mar 23 19:52:33 2023 +0000
+++ b/sys/nfs/nfs_srvsubs.c     Thu Mar 23 19:52:42 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_srvsubs.c,v 1.16 2022/04/27 17:38:52 hannken Exp $ */
+/*     $NetBSD: nfs_srvsubs.c,v 1.17 2023/03/23 19:52:42 riastradh Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_srvsubs.c,v 1.16 2022/04/27 17:38:52 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_srvsubs.c,v 1.17 2023/03/23 19:52:42 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -129,7 +129,7 @@ nfs_namei(struct nameidata *ndp, nfsrvfh
        *retdirp = NULL;
        ndp->ni_pathbuf = NULL;
 
-       if ((len + 1) > NFS_MAXPATHLEN)
+       if (len > NFS_MAXPATHLEN - 1)
                return (ENAMETOOLONG);
        if (len == 0)
                return (EACCES);



Home | Main Index | Thread Index | Old Index