File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
src/main/java/eu/righettod Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -1176,10 +1176,13 @@ public static boolean isPathSafe(String path) {
1176
1176
if (path != null && !path .isEmpty ()) {
1177
1177
//URL decode the path if case of data coming from a web context
1178
1178
String decodedPath = applyURLDecoding (path , decodingRoundThreshold );
1179
+ //Remove any path escaping sequence
1180
+ decodedPath = decodedPath .replace ("\\ /" , "/" ).replace ("\\ \\ " , "\\ " );
1179
1181
//Ensure that no path traversal path is present
1180
1182
File f = new File (decodedPath );
1181
1183
String canonicalPath = f .getCanonicalPath ();
1182
1184
String absolutePath = f .getAbsolutePath ();
1185
+ System .out .println ("---" );
1183
1186
System .out .printf ("IN PATH : %s\n " , path );
1184
1187
System .out .printf ("DECODED PATH: %s\n " , decodedPath );
1185
1188
System .out .printf ("CANONICAL PATH: %s\n " , canonicalPath );
You can’t perform that action at this time.
0 commit comments