    public String extractPathWithinPattern(String pattern, String path) {
        final String[] patternParts = tokenizeToStringArray(pattern, this.pathSeparator);
        final String[] pathParts = tokenizeToStringArray(path, this.pathSeparator);

        final StringBuilder buffer = new StringBuilder();

        // Add any path parts that have a wildcarded pattern part.
        int puts = 0;
        for (int i = 0; i < patternParts.length; i++) {
            final String patternPart = patternParts[i];
            if ((patternPart.indexOf('*') > -1 || patternPart.indexOf('?') > -1) && pathParts.length >= i + 1) {
                if (puts > 0 || (i == 0 && !pattern.startsWith(this.pathSeparator))) {
                    buffer.append(this.pathSeparator);
                }
                buffer.append(pathParts[i]);
                puts++;
            }
        }

        // Append any trailing path parts.
        for (int i = patternParts.length; i < pathParts.length; i++) {
            if (puts > 0 || i > 0) {
                buffer.append(this.pathSeparator);
            }
            buffer.append(pathParts[i]);
        }

        return buffer.toString();
    }
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.