FreeBSD/contrib/subversion/subversion/svnserve/serve.c
/* Check that PATH is a valid repository path, meaning it doesn't contain any
   '..' path segments.
   NOTE: This is similar to svn_path_is_backpath_present, but that function
   assumes the path separator is '/'.  This function also checks for
   segments delimited by the local path separator. */
Check that PATH is a valid repository path, meaning it doesn't contain any
'..' path segments.
NOTE: This is similar to svn_path_is_backpath_present, but that function
assumes the path separator is '/'.  This function also checks for
segments delimited by the local path separator.
Check that PATH is a valid repository path meaning it doesn ' t contain any ' .. ' path segments . NOTE : This is similar to svn_path_is_backpath_present but that function assumes the path separator is ' / ' . This function also checks for segments delimited by the local path separator .
static svn_boolean_t
repos_path_valid(const char *path)
{
  const char *s = path;
  while (*s)
    {
      while (*path && *path != '/' && *path != SVN_PATH_LOCAL_SEPARATOR)
        ++path;
#ifdef WIN32
      if (path - s >= 2 && strspn(s, ". ") == (size_t)(path - s))
        return FALSE;
#else  
      if (path - s == 2 && s[0] == '.' && s[1] == '.')
        return FALSE;
#endif
      while (*path && (*path == '/' || *path == SVN_PATH_LOCAL_SEPARATOR))
        ++path;
      s = path;
    }
  return TRUE;
}
static svn_boolean_t repos_path_valid ( const char * path ) { const char * s = path ; while ( * s ) { while ( * path && * path != ' ' && * path != SVN_PATH_LOCAL_SEPARATOR ) ++ path ; #ifdef WIN32 if ( path - s >= 2 && strspn ( s , " " ) == ( size_t ) ( path - s ) ) return FALSE ; #else if ( path - s == 2 && s [ 0 ] == ' ' && s [ 1 ] == ' ' ) return FALSE ; #endif while ( * path && ( * path == ' ' || * path == SVN_PATH_LOCAL_SEPARATOR ) ) ++ path ; s = path ; } return TRUE ; }
Check that PATH is a valid repository path, meaning it doesn't contain any
'..' path segments.
Check that PATH is a valid repository path meaning it doesn ' t contain any ' .. ' path segments .
/* Scan for the end of the segment. */ /* Check for '..'. */ /* On Windows, don't allow sequences of more than one character
         consisting of just dots and spaces.  Win32 functions treat
         paths such as ".. " and "......." inconsistently.  Make sure
         no one can escape out of the root. */ /* ! WIN32 */ /* Skip all separators. */