Example #1
0
        /* goodG2B() - use goodsource and badsink */
        private static void GoodG2B()
        {
            StringBuilder data = CWE476_NULL_Pointer_Dereference__StringBuilder_61b.GoodG2BSource();

            /* POTENTIAL FLAW: null dereference will occur if data is null */
            IO.WriteLine("" + data.Length);
        }
Example #2
0
        public override void Bad()
        {
            StringBuilder data = CWE476_NULL_Pointer_Dereference__StringBuilder_61b.BadSource();

            /* POTENTIAL FLAW: null dereference will occur if data is null */
            IO.WriteLine("" + data.Length);
        }
Example #3
0
        /* goodB2G() - use badsource and goodsink */
        private static void GoodB2G()
        {
            StringBuilder data = CWE476_NULL_Pointer_Dereference__StringBuilder_61b.GoodB2GSource();

            /* FIX: validate that data is non-null */
            if (data != null)
            {
                IO.WriteLine("" + data.Length);
            }
            else
            {
                IO.WriteLine("data is null");
            }
        }