/* goodB2G2() - use badsource and goodsink by reversing the blocks in the if in the sink function */ private void GoodB2G2() { int[] data = null; /* POTENTIAL FLAW: data is null */ data = null; goodB2G2PublicStatic = true; CWE476_NULL_Pointer_Dereference__int_array_22b.GoodB2G2Sink(data); }
/* goodG2B() - use goodsource and badsink */ private void GoodG2B() { int[] data = null; /* FIX: hardcode data to non-null */ data = new int[5]; goodG2BPublicStatic = true; CWE476_NULL_Pointer_Dereference__int_array_22b.GoodG2BSink(data); }
public override void Bad() { int[] data = null; /* POTENTIAL FLAW: data is null */ data = null; badPublicStatic = true; CWE476_NULL_Pointer_Dereference__int_array_22b.BadSink(data); }