Example #1
0
        /* goodG2B() - use goodsource and badsink */
        public static void GoodG2BSink(CWE369_Divide_by_Zero__int_Connect_tcp_modulo_67a.Container dataContainer)
        {
            int data = dataContainer.containerOne;

            /* POTENTIAL FLAW: Zero modulus will cause an issue.  An integer division will
             * result in an exception.  */
            IO.WriteLine("100%" + data + " = " + (100 % data) + "\n");
        }
Example #2
0
        /* goodB2G() - use badsource and goodsink */
        public static void GoodB2GSink(CWE369_Divide_by_Zero__int_Connect_tcp_modulo_67a.Container dataContainer)
        {
            int data = dataContainer.containerOne;

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