Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/config Error out if a given path is absolute.



details:   https://anonhg.NetBSD.org/src/rev/43e5851f7cfc
branches:  trunk
changeset: 340225:43e5851f7cfc
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Fri Aug 28 08:56:39 2015 +0000

description:
Error out if a given path is absolute.

diffstat:

 usr.bin/config/files.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 416ced5faaa2 -r 43e5851f7cfc usr.bin/config/files.c
--- a/usr.bin/config/files.c    Fri Aug 28 08:31:28 2015 +0000
+++ b/usr.bin/config/files.c    Fri Aug 28 08:56:39 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: files.c,v 1.18 2014/11/17 00:53:15 uebayasi Exp $      */
+/*     $NetBSD: files.c,v 1.19 2015/08/28 08:56:39 uebayasi Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: files.c,v 1.18 2014/11/17 00:53:15 uebayasi Exp $");
+__RCSID("$NetBSD: files.c,v 1.19 2015/08/28 08:56:39 uebayasi Exp $");
 
 #include <sys/param.h>
 #include <errno.h>
@@ -106,6 +106,10 @@
                    path);
                goto bad;
        }
+       if (*path == '/') {
+               cfgerror("path must be relative");
+               goto bad;
+       }
 
        /* find last part of pathname, and same without trailing suffix */
        tail = strrchr(path, '/');



Home | Main Index | Thread Index | Old Index