Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/whereis PR/25680: Christian Biere: whereis/which ret...



details:   https://anonhg.NetBSD.org/src/rev/b71691b40e81
branches:  trunk
changeset: 566880:b71691b40e81
user:      christos <christos%NetBSD.org@localhost>
date:      Sun May 23 02:24:06 2004 +0000

description:
PR/25680: Christian Biere: whereis/which return invalid information with
huge path

diffstat:

 usr.bin/whereis/whereis.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 65ec6253fad2 -r b71691b40e81 usr.bin/whereis/whereis.c
--- a/usr.bin/whereis/whereis.c Sun May 23 01:45:21 2004 +0000
+++ b/usr.bin/whereis/whereis.c Sun May 23 02:24:06 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: whereis.c,v 1.16 2004/04/01 22:14:48 christos Exp $    */
+/*     $NetBSD: whereis.c,v 1.17 2004/05/23 02:24:06 christos Exp $    */
 
 /*-
  * Copyright (c) 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)whereis.c  8.3 (Berkeley) 5/4/95";
 #endif
-__RCSID("$NetBSD: whereis.c,v 1.16 2004/04/01 22:14:48 christos Exp $");
+__RCSID("$NetBSD: whereis.c,v 1.17 2004/05/23 02:24:06 christos Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -122,6 +122,9 @@
                                if (strlen(t) == 0)
                                        t = ".";
                        (void)snprintf(path, sizeof(path), "%s/%s", t, *argv);
+                       len = snprintf(path, sizeof(path), "%s/%s", t, *argv);
+                       if (len >= sizeof(path))
+                               continue;
                        if (stat(path, &sb) == -1)
                                continue;
                        if (!S_ISREG(sb.st_mode))



Home | Main Index | Thread Index | Old Index