Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 391dd5b

Browse files
Update java/ql/src/Security/CWE/CWE-023/PartialPathTraversalGood.java
Co-authored-by: Jonathan Leitschuh <[email protected]>
1 parent ebe48ec commit 391dd5b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

java/ql/src/Security/CWE/CWE-023/PartialPathTraversalGood.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class PartialPathTraversalGood {
44
public void example(File dir, File parent) throws IOException {
5-
if (!dir.getCanonicalPath().startsWith(parent.getCanonicalPath().toPath())) {
5+
if (!dir.getCanonicalPath().toPath().startsWith(parent.getCanonicalPath().toPath())) {
66
throw new IOException("Invalid directory: " + dir.getCanonicalPath());
77
}
88
}

0 commit comments

Comments
 (0)