/* goodG2B() - use goodsource and badsink */ private static void GoodG2B() { int?data; /* FIX: hardcode data to non-null */ data = Int32.Parse("5"); int?[] dataArray = new int?[5]; dataArray[2] = data; CWE476_NULL_Pointer_Dereference__Integer_66b.GoodG2BSink(dataArray); }
/* goodB2G() - use badsource and goodsink */ private static void GoodB2G() { int?data; /* POTENTIAL FLAW: data is null */ data = null; int?[] dataArray = new int?[5]; dataArray[2] = data; CWE476_NULL_Pointer_Dereference__Integer_66b.GoodB2GSink(dataArray); }
public override void Bad() { int?data; /* POTENTIAL FLAW: data is null */ data = null; int?[] dataArray = new int?[5]; dataArray[2] = data; CWE476_NULL_Pointer_Dereference__Integer_66b.BadSink(dataArray); }