Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public static String sanitizePath(String sUnsanitized) throws URISyntaxException, EncodingException {
  2.  
  3. String sSanitized = SAPI.encoder().canonicalize(sUnsanitized);
  4. return sSanitized;
  5.  
  6. }
  7.  
  8.  
  9. //// the main method code snippet /////
  10.  
  11. String sSanitizedPath = Utils.sanitizePath(file.getOriginalFilename());
  12.  
  13. -- fortify scan detects problem here ..in below line --
  14.  
  15. File filePath = new File(AppInitializer.UPLOAD_LOCATION, sSanitizedPath);
  16.  
  17. String canonicalPath = filePath.getCanonicalPath();
  18. FileOutputStream fileOutputStream = new FileOutputStream(canonicalPath);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement