diff options
Diffstat (limited to 'bin/systrace/policy.c')
-rw-r--r-- | bin/systrace/policy.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/bin/systrace/policy.c b/bin/systrace/policy.c index fbdb57e22d7..6daf5957a9c 100644 --- a/bin/systrace/policy.c +++ b/bin/systrace/policy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: policy.c,v 1.22 2002/12/09 07:22:53 itojun Exp $ */ +/* $OpenBSD: policy.c,v 1.23 2002/12/09 07:23:52 itojun Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -481,18 +481,26 @@ static char * systrace_policyline(char *line) { char *p; + int quoted = 0; if ((p = strchr(line, '\n')) == NULL) return (NULL); *p = '\0'; - /* Remove comments from the input line */ - p = strchr(line, '#'); - if (p != NULL) { - if (p != line && *(p-1) == '-') - p = strchr(p + 1, '#'); - if (p != NULL) + /* Remove comments from the input line but ignore # that are part + * of the system call name or within quotes. + */ + for (p = line; *p; p++) { + if (*p == '"') + quoted = quoted ? 0 : 1; + if (*p == '#') { + if (quoted) + continue; + if (p != line && *(p-1) == '-') + continue; *p = '\0'; + break; + } } /* Remove trailing white space */ |