VERACODE外部控制路径问题的文件名

时间:2014-01-28 18:49:48

标签: asp.net path controls external filenames

我正在asp.net中开发一个应用程序。当使用Veracode的应用程序扫描我的某个功能时,会显示以下错误“文件名或路径的外部控制”。 任何人都知道如何解决此错误?

 public void UploadFileToTemp(Stream streamFile, string fileName)
    {


        if (!Directory.Exists( ConfigurationManager.AppSettings["FolderName"]))
        {
            Directory.CreateDirectory("C:\\Temp");
        }

        string name = MakeValidFileName(fileName);
        string path = MakeValidPathName( ConfigurationManager.AppSettings["FolderName"] , name);
        FileStream fileStream = File.Create(ConfigurationManager.AppSettings["FolderName"]+"TEstSubida1", (int)streamFile.Length);
        // Initialize the bytes array with the stream length and then fill it with data
        byte[] bytesInStream = new byte[streamFile.Length];
        streamFile.Read(bytesInStream, 0, bytesInStream.Length);
        // Use write method to write to the file specified above
        fileStream.Write(bytesInStream, 0, bytesInStream.Length);
        fileStream.Close();
        fileStream.Dispose();
    }

0 个答案:

没有答案