Example #1
0
        /* goodG2B() - use goodsource and badsink */
        private static void GoodG2B()
        {
            int count = CWE400_Uncontrolled_Resource_Consumption__sleep_Listen_tcp_61b.GoodG2BSource();

            /* POTENTIAL FLAW: Use count as the input to Thread.Sleep() */
            Thread.Sleep(count);
        }
Example #2
0
        public override void Bad()
        {
            int count = CWE400_Uncontrolled_Resource_Consumption__sleep_Listen_tcp_61b.BadSource();

            /* POTENTIAL FLAW: Use count as the input to Thread.Sleep() */
            Thread.Sleep(count);
        }
Example #3
0
        /* goodB2G() - use badsource and goodsink */
        private static void GoodB2G()
        {
            int count = CWE400_Uncontrolled_Resource_Consumption__sleep_Listen_tcp_61b.GoodB2GSource();

            /* FIX: Validate count before using it in a call to Thread.Sleep() */
            if (count > 0 && count <= 2000)
            {
                Thread.Sleep(count);
            }
        }