/* goodG2B() - use goodsource and badsink */ public static void GoodG2BSink(CWE400_Uncontrolled_Resource_Consumption__sleep_Connect_tcp_67a.Container countContainer) { int count = countContainer.containerOne; /* POTENTIAL FLAW: Use count as the input to Thread.Sleep() */ Thread.Sleep(count); }
/* goodB2G() - use badsource and goodsink */ public static void GoodB2GSink(CWE400_Uncontrolled_Resource_Consumption__sleep_Connect_tcp_67a.Container countContainer) { int count = countContainer.containerOne; /* FIX: Validate count before using it in a call to Thread.Sleep() */ if (count > 0 && count <= 2000) { Thread.Sleep(count); } }