admin管理员组

文章数量:1312816

Good Morning,

I'm experiencing constant CWE-89 errors no matter how I refactor the following code below especially this line get's flagged (the fill):

sqlAdpt.Fill(dtblData);

I tried using ExecuteNonQuery, ExecuteScalar and some other methods and still getting this error with Veracode.

Please advise how to fix so that Veracode doesn't flag it.

 public DataTable GetFYLocationsBySystemID(string query, ref string strErrorMsg)

 {

   SqlConnection sqlCon = new SqlConnection();

   SqlDataAdapter sqlAdpt = new SqlDataAdapter();

   SqlCommand sqlComm = new SqlCommand();

   DataTable dtblData = new DataTable();

 

   try

   {

     sqlCon = new SqlConnection(_strSqlString);

     sqlComm = new SqlCommand(query, sqlCon);

     sqlComm.CommandType = CommandType.Text;

 

     sqlAdpt.SelectCommand = sqlComm;

     sqlAdpt.Fill(dtblData);

 

     return dtblData;

   }

   catch (Exception ex)

   {

     strErrorMsg = ex.Message;

     return null;

   }

   finally

   {

     sqlCon.Close();

     sqlCon.Dispose();

     sqlComm.Dispose();

   }

 }

Thanks

本文标签: Why am I getting Constant CWE89 Error39s in VeracodeStack Overflow