Source-Changes-HG archive

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

[src/netbsd-1-6]: src/bin/csh Pull up revision 1.23 (requested by kleink in t...



details:   https://anonhg.NetBSD.org/src/rev/b39ca4736562
branches:  netbsd-1-6
changeset: 531333:b39ca4736562
user:      tron <tron%NetBSD.org@localhost>
date:      Tue May 11 12:26:13 2004 +0000

description:
Pull up revision 1.23 (requested by kleink in ticket #1688):
avoid overflow in strcpy.

diffstat:

 bin/csh/dir.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r d0074f7e71d6 -r b39ca4736562 bin/csh/dir.c
--- a/bin/csh/dir.c     Tue May 11 12:25:26 2004 +0000
+++ b/bin/csh/dir.c     Tue May 11 12:26:13 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.18.2.1 2004/05/11 12:25:26 tron Exp $ */
+/* $NetBSD: dir.c,v 1.18.2.2 2004/05/11 12:26:13 tron Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c      8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dir.c,v 1.18.2.1 2004/05/11 12:25:26 tron Exp $");
+__RCSID("$NetBSD: dir.c,v 1.18.2.2 2004/05/11 12:26:13 tron Exp $");
 #endif
 #endif /* not lint */
 
@@ -685,8 +685,8 @@
            if (sp != cp && !adrof(STRignore_symlinks) &&
                (cc = readlink(short2str(cp), tlink,
                               sizeof(tlink) - 1)) >= 0) {
+               tlink[cc] = '\0';
                (void)Strcpy(slink, str2short(tlink));
-               slink[cc] = '\0';
 
                if (slash)
                    *p = '/';
@@ -768,8 +768,8 @@
            if (sp != cp && adrof(STRchase_symlinks) &&
                !adrof(STRignore_symlinks) &&
                (cc = readlink(short2str(cp), tlink, sizeof(tlink)-1)) >= 0) {
+               tlink[cc] = '\0';
                (void)Strcpy(slink, str2short(tlink));
-               slink[cc] = '\0';
 
                /*
                 * restore the '/'.



Home | Main Index | Thread Index | Old Index