Source-Changes-HG archive

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

[src/netbsd-1-6]: src/usr.bin/newsyslog Pull up revision 1.45 (requested by i...



details:   https://anonhg.NetBSD.org/src/rev/c253f276f7a9
branches:  netbsd-1-6
changeset: 528104:c253f276f7a9
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jun 27 03:27:46 2002 +0000

description:
Pull up revision 1.45 (requested by itojun in ticket #383):
don't let newsyslog follow symlink (could be abused to do tricks).
OpenBSD PR 1913.

diffstat:

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

diffs (30 lines):

diff -r 5a25dfc91a69 -r c253f276f7a9 usr.bin/newsyslog/newsyslog.c
--- a/usr.bin/newsyslog/newsyslog.c     Thu Jun 27 01:26:59 2002 +0000
+++ b/usr.bin/newsyslog/newsyslog.c     Thu Jun 27 03:27:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: newsyslog.c,v 1.43.2.1 2002/06/26 23:32:53 lukem Exp $ */
+/*     $NetBSD: newsyslog.c,v 1.43.2.2 2002/06/27 03:27:46 lukem Exp $ */
 
 /*
  * Copyright (c) 1999, 2000 Andrew Doran <ad%NetBSD.org@localhost>
@@ -55,7 +55,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: newsyslog.c,v 1.43.2.1 2002/06/26 23:32:53 lukem Exp $");
+__RCSID("$NetBSD: newsyslog.c,v 1.43.2.2 2002/06/27 03:27:46 lukem Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -434,6 +434,11 @@
                        err(EXIT_FAILURE, "%s", log->logfile);
        }
 
+       if (!S_ISREG(sb.st_mode)) {
+               PRHDRINFO(("not a regular file --> skip log\n"));
+               return;
+       }
+
        /* Size of the log file in kB. */
        size = ((size_t)sb.st_blocks * S_BLKSIZE) >> 10;
 



Home | Main Index | Thread Index | Old Index