最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - How to fix flaws of the type CWE 73 External Control of File Name or Path (new File) - Stack Overflow

programmeradmin7浏览0评论

I have batch writer class to get the files from the directory but getting the CWE 73 flaw in the below mentioned line. is anyone have a solution to mitigate this flaw?

this.Dir - this is the DB property name to get the path from DB.


String filePath;
File folder=new File(this.Dir); //CWE 73 flaw detected

File[] listOfFiles = folder.listFiles();
if (null != listOfFiles && listOfFiles.length > 0) {
    for (File file : listOfFiles) {
       if (listOfFiles.length > 1)
          filePath = file.getAbsolutePath();

I gone through the below veracode documentation but still i am not getting possible fix for above mentioned code.

发布评论

评论列表(0)

  1. 暂无评论