/* goodG2B() - use goodsource and badsink */ private static void GoodG2B() { string data; /* FIX: Use a hardcoded string */ data = "foo"; Dictionary <int, string> dataDictionary = new Dictionary <int, string>(); dataDictionary.Add(0, data); dataDictionary.Add(1, data); dataDictionary.Add(2, data); CWE23_Relative_Path_Traversal__Environment_74b.GoodG2BSink(dataDictionary); }
public override void Bad() { string data; /* get environment variable ADD */ /* POTENTIAL FLAW: Read data from an environment variable */ data = Environment.GetEnvironmentVariable("ADD"); Dictionary <int, string> dataDictionary = new Dictionary <int, string>(); dataDictionary.Add(0, data); dataDictionary.Add(1, data); dataDictionary.Add(2, data); CWE23_Relative_Path_Traversal__Environment_74b.BadSink(dataDictionary); }