Ejemplo n.º 1
0
        /* goodG2B() - use goodsource and badsink */
        private static void GoodG2B()
        {
            int data = CWE369_Divide_by_Zero__int_NetClient_divide_61b.GoodG2BSource();

            /* POTENTIAL FLAW: Zero denominator will cause an issue.  An integer division will
             * result in an exception. */
            IO.WriteLine("bad: 100/" + data + " = " + (100 / data) + "\n");
        }
Ejemplo n.º 2
0
        public override void Bad()
        {
            int data = CWE369_Divide_by_Zero__int_NetClient_divide_61b.BadSource();

            /* POTENTIAL FLAW: Zero denominator will cause an issue.  An integer division will
             * result in an exception. */
            IO.WriteLine("bad: 100/" + data + " = " + (100 / data) + "\n");
        }
Ejemplo n.º 3
0
        /* goodB2G() - use badsource and goodsink */
        private static void GoodB2G()
        {
            int data = CWE369_Divide_by_Zero__int_NetClient_divide_61b.GoodB2GSource();

            /* FIX: test for a zero denominator */
            if (data != 0)
            {
                IO.WriteLine("100/" + data + " = " + (100 / data) + "\n");
            }
            else
            {
                IO.WriteLine("This would result in a divide by zero");
            }
        }