/* goodG2B() - use goodsource and badsink */ private static void GoodG2B() { int?data = CWE476_NULL_Pointer_Dereference__Integer_61b.GoodG2BSource(); /* POTENTIAL FLAW: null dereference will occur if data is null */ IO.WriteLine("" + data.ToString()); }
public override void Bad() { int?data = CWE476_NULL_Pointer_Dereference__Integer_61b.BadSource(); /* POTENTIAL FLAW: null dereference will occur if data is null */ IO.WriteLine("" + data.ToString()); }
/* goodB2G() - use badsource and goodsink */ private static void GoodB2G() { int?data = CWE476_NULL_Pointer_Dereference__Integer_61b.GoodB2GSource(); /* FIX: validate that data is non-null */ if (data != null) { IO.WriteLine("" + data.ToString()); } else { IO.WriteLine("data is null"); } }