Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/mountd Fix path component parsing bug that I've int...



details:   https://anonhg.NetBSD.org/src/rev/0ffde8dbb87f
branches:  trunk
changeset: 482133:0ffde8dbb87f
user:      enami <enami%NetBSD.org@localhost>
date:      Tue Feb 15 04:51:56 2000 +0000

description:
Fix path component parsing bug that I've introduced in previous commit.

diffstat:

 usr.sbin/mountd/mountd.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (43 lines):

diff -r 481204b2e09a -r 0ffde8dbb87f usr.sbin/mountd/mountd.c
--- a/usr.sbin/mountd/mountd.c  Tue Feb 15 04:41:45 2000 +0000
+++ b/usr.sbin/mountd/mountd.c  Tue Feb 15 04:51:56 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mountd.c,v 1.59 2000/02/03 09:59:22 enami Exp $     */
+/* $NetBSD: mountd.c,v 1.60 2000/02/15 04:51:56 enami Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -51,7 +51,7 @@
 #if 0
 static char     sccsid[] = "@(#)mountd.c  8.15 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: mountd.c,v 1.59 2000/02/03 09:59:22 enami Exp $");
+__RCSID("$NetBSD: mountd.c,v 1.60 2000/02/15 04:51:56 enami Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -1715,10 +1715,11 @@
                        break;
 
                *cp-- = savedc;
-               /* back up over the last component */
+               /* back up over the last component. */
                while (cp > dirp && *cp != '/')
                        cp--;
-               while (cp > dirp && *(cp - 1) != '/')
+               /* skip over the slashes except the very first one (root). */
+               while (cp > dirp && *cp == '/')
                        cp--;
                if (cp == dirp) {
                        if (debug)
@@ -1726,8 +1727,8 @@
                        errno = 0;      /* This is not a system error. XXX */
                        goto out;       /* Don't restore the savedc. */
                }
-               /* Now, cp points the first slash. */
-               savedc = *cp;
+               /* Now, cp points the character just before a slash. */
+               savedc = *++cp;
                *cp = '\0';
        }
 



Home | Main Index | Thread Index | Old Index