FreeBSD/sys/netpfil/pf/pf_table.c
/*
 * Rewrite anchors referenced by tables to remove slashes
 * and check for validity.
 */
Rewrite anchors referenced by tables to remove slashes
and check for validity.
Rewrite anchors referenced by tables to remove slashes and check for validity .
static int
pfr_fix_anchor(char *anchor)
{
	size_t siz = MAXPATHLEN;
	int i;
	if (anchor[0] == '/') {
		char *path;
		int off;
		path = anchor;
		off = 1;
		while (*++path == '/')
			off++;
		bcopy(path, anchor, siz - off);
		memset(anchor + siz - off, 0, off);
	}
	if (anchor[siz - 1])
		return (-1);
	for (i = strlen(anchor); i < siz; i++)
		if (anchor[i])
			return (-1);
	return (0);
}
static int pfr_fix_anchor ( char * anchor ) { size_t siz = MAXPATHLEN ; int i ; if ( anchor [ 0 ] == ' ' ) { char * path ; int off ; path = anchor ; off = 1 ; while ( * ++ path == ' ' ) off ++ ; bcopy ( path , anchor , siz - off ) ; memset ( anchor + siz - off , 0 , off ) ; } if ( anchor [ siz - 1 ] ) return ( -1 ) ; for ( i = strlen ( anchor ) ; i < siz ; i ++ ) if ( anchor [ i ] ) return ( -1 ) ; return ( 0 ) ; }
Rewrite anchors referenced by tables to remove slashes
 and check for validity.
Rewrite anchors referenced by tables to remove slashes and check for validity .