-/* $OpenBSD: filter.c,v 1.34 2012/12/04 02:24:47 deraadt Exp $ */
+/* $OpenBSD: filter.c,v 1.35 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
int policynr, const char *emulation, const char *name,
char *output, short *pfuture, struct intercept_pid *icpid)
{
- char line[2*MAXPATHLEN], *p;
- char compose[2*MAXPATHLEN];
+ char line[2*PATH_MAX], *p;
+ char compose[2*PATH_MAX];
struct filter *filter;
struct policy *policy;
short action;
char *
filter_expand(char *data)
{
- static char expand[2*MAXPATHLEN];
+ static char expand[2*PATH_MAX];
strlcpy(expand, data, sizeof(expand));
filter_dynamicexpand(struct intercept_pid *icpid, char *data)
{
extern char cwd[];
- static char expand[2*MAXPATHLEN];
+ static char expand[2*PATH_MAX];
strlcpy(expand, data, sizeof(expand));
-/* $OpenBSD: intercept.c,v 1.62 2014/07/20 01:38:40 guenther Exp $ */
+/* $OpenBSD: intercept.c,v 1.63 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include <err.h>
#include <libgen.h>
goto abort;
if (before != NULL)
- strlcpy(before, name, MAXPATHLEN);
+ strlcpy(before, name, PATH_MAX);
if ((name = normalize_filenameat(fd, pid, atfd, name, userp)) == NULL)
goto abort;
char *
normalize_filenameat(int fd, pid_t pid, int atfd, char *name, int userp)
{
- static char cwd[2*MAXPATHLEN];
+ static char cwd[2*PATH_MAX];
int havecwd = 0;
/*
}
if (userp != ICLINK_NONE) {
- static char rcwd[2*MAXPATHLEN];
+ static char rcwd[2*PATH_MAX];
char *base = basename(cwd);
int failed = 0;
/* Special handling for the exec call */
if (!strcmp(name, "execve")) {
void *addr;
- char *argname, before[MAXPATHLEN];
+ char *argname, before[PATH_MAX];
icpid->execve_code = code;
icpid->policynr = policynr;
struct stat sb;
int idx = 0, n, nlnk = 0, serrno = errno;
const char *q;
- char *p, wbuf[2][MAXPATHLEN];
+ char *p, wbuf[2][PATH_MAX];
size_t len;
/*
/* If relative path, start from current working directory. */
if (*path != '/') {
- if (getcwd(resolved, MAXPATHLEN) == NULL) {
+ if (getcwd(resolved, PATH_MAX) == NULL) {
p[0] = '.';
p[1] = 0;
return (NULL);
}
/* Append this component. */
- if (p - resolved + 1 + q - path + 1 > MAXPATHLEN) {
+ if (p - resolved + 1 + q - path + 1 > PATH_MAX) {
errno = ENAMETOOLONG;
if (p == resolved)
*p++ = '/';
return (NULL);
}
if (S_ISLNK(sb.st_mode)) {
- if (nlnk++ >= MAXSYMLINKS) {
+ if (nlnk++ >= SYMLOOP_MAX) {
errno = ELOOP;
return (NULL);
}
-/* $OpenBSD: intercept.h,v 1.26 2012/08/23 00:08:36 guenther Exp $ */
+/* $OpenBSD: intercept.h,v 1.27 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
#ifndef _INTERCEPT_H_
#define _INTERCEPT_H_
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/queue.h>
struct intercept_pid;
gid_t gid; /* current gid */
char username[LOGIN_NAME_MAX];
- char home[MAXPATHLEN]; /* current home dir for uid */
+ char home[PATH_MAX]; /* current home dir for uid */
void *data;
-/* $OpenBSD: lex.l,v 1.18 2006/07/02 12:34:15 sturm Exp $ */
+/* $OpenBSD: lex.l,v 1.19 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <err.h>
#include <stdarg.h>
#include <string.h>
-/* $OpenBSD: openbsd-syscalls.c,v 1.44 2013/10/17 10:21:58 deraadt Exp $ */
+/* $OpenBSD: openbsd-syscalls.c,v 1.45 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/syscall.h>
#undef SYSVMSG
#undef SYSVSHM
+#include <limits.h>
+
#include <sys/ioctl.h>
#include <sys/tree.h>
#include <dev/systrace.h>
-/* $OpenBSD: parse.y,v 1.18 2009/11/12 20:07:46 millert Exp $ */
+/* $OpenBSD: parse.y,v 1.19 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <pwd.h>
#include <grp.h>
#include <regex.h>
-/* $OpenBSD: policy.c,v 1.34 2013/11/21 15:54:46 deraadt Exp $ */
+/* $OpenBSD: policy.c,v 1.35 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
extern int userpolicy;
-static char policydir[MAXPATHLEN];
+static char policydir[PATH_MAX];
struct tmplqueue templates;
systrace_findpolicy_wildcard(const char *name)
{
struct policy tmp, *res;
- static char path[MAXPATHLEN], lookup[MAXPATHLEN];
+ static char path[PATH_MAX], lookup[PATH_MAX];
if (strlcpy(path, name, sizeof(path)) >= sizeof(path))
errx(1, "%s: path name overflow", __func__);
char *
systrace_policyfilename(char *dirname, const char *name)
{
- static char file[2*MAXPATHLEN];
+ static char file[2*PATH_MAX];
const char *p;
int i, plen;
int
systrace_templatedir(void)
{
- char filename[MAXPATHLEN];
+ char filename[PATH_MAX];
DIR *dir = NULL;
struct stat sb;
struct dirent *dp;
FILE *fp;
int fd;
char *p;
- char tmpname[2*MAXPATHLEN];
- char finalname[2*MAXPATHLEN];
+ char tmpname[2*PATH_MAX];
+ char finalname[2*PATH_MAX];
struct filter *filter;
struct timeval now;
-/* $OpenBSD: register.c,v 1.24 2012/12/04 02:24:47 deraadt Exp $ */
+/* $OpenBSD: register.c,v 1.25 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
#include <sys/tree.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <err.h>
-/* $OpenBSD: systrace-error.c,v 1.3 2014/08/10 00:20:55 guenther Exp $ */
+/* $OpenBSD: systrace-error.c,v 1.4 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
#include <sys/tree.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>
-/* $OpenBSD: systrace-translate.c,v 1.24 2014/08/10 04:57:33 guenther Exp $ */
+/* $OpenBSD: systrace-translate.c,v 1.25 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
#include <sys/socket.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <sys/signal.h>
#include <stdint.h>
#include <limits.h>
#include <stdlib.h>
-/* $OpenBSD: systrace.c,v 1.61 2014/11/26 18:34:51 millert Exp $ */
+/* $OpenBSD: systrace.c,v 1.62 2015/01/16 00:19:12 deraadt Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
int cradle = 0; /* Set if we are running in cradle mode */
int logtofile = 0; /* Log to file instead of syslog */
FILE *logfile; /* default logfile to send to if enabled */
-char cwd[MAXPATHLEN]; /* Current working directory */
-char home[MAXPATHLEN]; /* Home directory of user */
+char cwd[PATH_MAX]; /* Current working directory */
+char home[PATH_MAX]; /* Home directory of user */
char username[LOGIN_NAME_MAX]; /* Username: predicate match and expansion */
char *guipath = _PATH_XSYSTRACE; /* Path to GUI executable */
-char dirpath[MAXPATHLEN];
+char dirpath[PATH_MAX];
static struct event ev_read;
static struct event ev_timeout;
cradle_setup(char *pathtogui)
{
struct stat sb;
- char cradlepath[MAXPATHLEN], cradleuipath[MAXPATHLEN];
+ char cradlepath[PATH_MAX], cradleuipath[PATH_MAX];
snprintf(dirpath, sizeof(dirpath), "/tmp/systrace-%d", getuid());