MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pfr_fix_anchor

Function pfr_fix_anchor

freebsd/netpfil/pf/pf_table.c:1731–1754  ·  view source on GitHub ↗

* Rewrite anchors referenced by tables to remove slashes * and check for validity. */

Source from the content-addressed store, hash-verified

1729 * and check for validity.
1730 */
1731static int
1732pfr_fix_anchor(char *anchor)
1733{
1734 size_t siz = MAXPATHLEN;
1735 int i;
1736
1737 if (anchor[0] == '/') {
1738 char *path;
1739 int off;
1740
1741 path = anchor;
1742 off = 1;
1743 while (*++path == '/')
1744 off++;
1745 bcopy(path, anchor, siz - off);
1746 memset(anchor + siz - off, 0, off);
1747 }
1748 if (anchor[siz - 1])
1749 return (-1);
1750 for (i = strlen(anchor); i < siz; i++)
1751 if (anchor[i])
1752 return (-1);
1753 return (0);
1754}
1755
1756int
1757pfr_table_count(struct pfr_table *filter, int flags)

Callers 4

pfr_clr_tablesFunction · 0.85
pfr_get_tablesFunction · 0.85
pfr_get_tstatsFunction · 0.85
pfr_validate_tableFunction · 0.85

Calls 1

memsetFunction · 0.85

Tested by

no test coverage detected