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

Co-authored-by: Jonathan Leitschuh <jonathan.leitschuh@gmail.com>
This commit is contained in:
smehta23
2022-07-01 10:40:38 -04:00
committed by GitHub
parent c6f2f61bfb
commit 209a21655a

View File

@@ -1,7 +1,7 @@
import java.io.File;
public class PartialPathTraversalGood {
public void esapiExample(File dir, File parent) throws IOException {
public void example(File dir, File parent) throws IOException {
if (!dir.getCanonicalPath().startsWith(parent.getCanonicalPath().toPath())) {
throw new IOException("Invalid directory: " + dir.getCanonicalPath());
}