Example #1
0
        /* 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;
            Dictionary <int, int> countDictionary = new Dictionary <int, int>();

            countDictionary.Add(0, count);
            countDictionary.Add(1, count);
            countDictionary.Add(2, count);
            CWE400_Uncontrolled_Resource_Consumption__Random_write_74b.GoodG2BSink(countDictionary);
        }
Example #2
0
        /* goodB2G() - use BadSource and GoodSink */
        private static void GoodB2G()
        {
            int count;

            /* POTENTIAL FLAW: Set count to a random value */
            count = (new Random()).Next();
            Dictionary <int, int> countDictionary = new Dictionary <int, int>();

            countDictionary.Add(0, count);
            countDictionary.Add(1, count);
            countDictionary.Add(2, count);
            CWE400_Uncontrolled_Resource_Consumption__Random_write_74b.GoodB2GSink(countDictionary);
        }
Example #3
0
        public override void Bad()
        {
            int count;

            /* POTENTIAL FLAW: Set count to a random value */
            count = (new Random()).Next();
            Dictionary <int, int> countDictionary = new Dictionary <int, int>();

            countDictionary.Add(0, count);
            countDictionary.Add(1, count);
            countDictionary.Add(2, count);
            CWE400_Uncontrolled_Resource_Consumption__Random_write_74b.BadSink(countDictionary);
        }