Skip to content

Commit 6669467

Browse files
committed
pfctl: Use pfctl_fopen
Use pfctl_fopen (which checks to ensure the given file isn't a directory) for pfctl -f /path/to/pf.conf. Otherwise, if you accidentally use a dir instead of a file (e.g. if you have an /etc/pf directory and don't notice the name when tab-completing), you successfully install an empty ruleset. ok sashan@ Obtained from: OpenBSD, sthen <[email protected]>, 2f48098846 Sponsored by: Rubicon Communications, LLC ("Netgate")
1 parent 9480465 commit 6669467

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sbin/pfctl/parse.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7091,7 +7091,7 @@ pushfile(const char *name, int secret)
70917091
free(nfile);
70927092
return (NULL);
70937093
}
7094-
} else if ((nfile->stream = fopen(nfile->name, "r")) == NULL) {
7094+
} else if ((nfile->stream = pfctl_fopen(nfile->name, "r")) == NULL) {
70957095
warn("%s: %s", __func__, nfile->name);
70967096
free(nfile->name);
70977097
free(nfile);

0 commit comments

Comments
 (0)