mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
Update java/ql/src/Security/CWE/CWE-023/PartialPathTraversalGood.java
Co-authored-by: Jonathan Leitschuh <jonathan.leitschuh@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class PartialPathTraversalGood {
|
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())) {
|
if (!dir.getCanonicalPath().startsWith(parent.getCanonicalPath().toPath())) {
|
||||||
throw new IOException("Invalid directory: " + dir.getCanonicalPath());
|
throw new IOException("Invalid directory: " + dir.getCanonicalPath());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user