diff options
author | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2004-09-09 22:08:43 +0000 |
---|---|---|
committer | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2004-09-09 22:08:43 +0000 |
commit | a43c3f9026f27033758dccd3e48b089490114475 (patch) | |
tree | fa2cf91724499ad4edb221dffa3132c28c6c44df /sys/net | |
parent | eb2d123bb8869fe588e790d31e483ad990a273ed (diff) |
Copy out anchors with relative paths and wildcards correctly,
from jaredy@, ok henning@, mcbride@, deraadt@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/pf_ioctl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 0278de8c19c..2eb48a748f2 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.129 2004/07/22 23:21:10 msf Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.130 2004/09/09 22:08:42 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -512,11 +512,13 @@ pf_anchor_copyout(const struct pf_ruleset *rs, const struct pf_rule *r, printf("pf_anchor_copyout: '%s' '%s'\n", a, b); return (1); } - strlcat(pr->anchor_call, b + (a[0] ? strlen(a) + 1 : 0), - sizeof(pr->anchor_call)); + if (strlen(b) > strlen(a)) + strlcat(pr->anchor_call, b + (a[0] ? strlen(a) + 1 : 0), + sizeof(pr->anchor_call)); } if (r->anchor_wildcard) - strlcat(pr->anchor_call, "/*", sizeof(pr->anchor_call)); + strlcat(pr->anchor_call, pr->anchor_call[0] ? "/*" : "*", + sizeof(pr->anchor_call)); return (0); } |