Error out if a given path is absolute.

This commit is contained in:
uebayasi 2015-08-28 08:56:39 +00:00
parent 47065f5afc
commit 36644ae2ff
1 changed files with 6 additions and 2 deletions

View File

@ -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 * Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
#endif #endif
#include <sys/cdefs.h> #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 <sys/param.h>
#include <errno.h> #include <errno.h>
@ -106,6 +106,10 @@ addfile(const char *path, struct condexpr *optx, u_char flags, const char *rule)
path); path);
goto bad; goto bad;
} }
if (*path == '/') {
cfgerror("path must be relative");
goto bad;
}
/* find last part of pathname, and same without trailing suffix */ /* find last part of pathname, and same without trailing suffix */
tail = strrchr(path, '/'); tail = strrchr(path, '/');