title: How to correct Path Manipulation error given by fortify?
body: <p>I need to read the properties file kept in  user_home folder.</p>
  
  <pre><code>PropsFile = System.getProperty("user.home") + System.getProperty("file.separator")+ "x.properties"; 
  </code></pre>
  
  <p>Fortify is giving path manipulation error in this line. The number of correct values is large so blacklisting is the only way possible. So to avoid it i changed the code as below.</p>
  
  <pre><code>String propsFile = null;
  StringBuffer sb = new StringBuffer();
  String xProperties = "x.properties";
  String userHome = System.getProperty("user.home");  // *
  if(userHome.contains("..\\"))
   userHome = userHome.replace("..\\", "");
  if(userHome.contains("../"))
   userHome = userHome.replace("../", "");
  if(userHome.contains("./"))
   userHome = userHome.replace("./", "");
  
  String fileSeperator = System.getProperty("file.separator");    // *
    if(fileSeperator.equals("/") || fileSeperator.equals("\\")){
      sb = sb.append(userHome).append(fileSeperator).append(xProperties);
      propsFile = sb.toString();
    }
  </code></pre>
  
  <p>but still fortify is giving me the same errors in (*) marked lines ( although the validation is done ).
  How can i remove the error ?</p>