/* goodG2B() - use GoodSource and BadSink */ private static void GoodG2B() { int count; /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ count = 2; Hashtable countHashtable = new Hashtable(5); countHashtable.Add(0, count); countHashtable.Add(1, count); countHashtable.Add(2, count); CWE400_Uncontrolled_Resource_Consumption__sleep_max_value_72b.GoodG2BSink(countHashtable); }
/* goodB2G() - use BadSource and GoodSink */ private static void GoodB2G() { int count; /* POTENTIAL FLAW: Set count to Integer.MaxValue */ count = int.MaxValue; Hashtable countHashtable = new Hashtable(5); countHashtable.Add(0, count); countHashtable.Add(1, count); countHashtable.Add(2, count); CWE400_Uncontrolled_Resource_Consumption__sleep_max_value_72b.GoodB2GSink(countHashtable); }
public override void Bad() { int count; /* POTENTIAL FLAW: Set count to Integer.MaxValue */ count = int.MaxValue; Hashtable countHashtable = new Hashtable(5); countHashtable.Add(0, count); countHashtable.Add(1, count); countHashtable.Add(2, count); CWE400_Uncontrolled_Resource_Consumption__sleep_max_value_72b.BadSink(countHashtable); }