diff --git a/java/ql/src/Security/CWE/CWE-023/PartialPathTraversalGood.java b/java/ql/src/Security/CWE/CWE-023/PartialPathTraversalGood.java index 2051460c8ba..859e759e088 100644 --- a/java/ql/src/Security/CWE/CWE-023/PartialPathTraversalGood.java +++ b/java/ql/src/Security/CWE/CWE-023/PartialPathTraversalGood.java @@ -2,7 +2,7 @@ import java.io.File; public class PartialPathTraversalGood { public void example(File dir, File parent) throws IOException { - if (!dir.getCanonicalPath().startsWith(parent.getCanonicalPath().toPath())) { + if (!dir.getCanonicalPath().toPath().startsWith(parent.getCanonicalPath().toPath())) { throw new IOException("Invalid directory: " + dir.getCanonicalPath()); } }