/* goodG2B() - use goodsource and badsink */ public static void GoodG2BSink(CWE476_NULL_Pointer_Dereference__Integer_67a.Container dataContainer) { int?data = dataContainer.containerOne; /* POTENTIAL FLAW: null dereference will occur if data is null */ IO.WriteLine("" + data.ToString()); }
/* goodB2G() - use badsource and goodsink */ public static void GoodB2GSink(CWE476_NULL_Pointer_Dereference__Integer_67a.Container dataContainer) { int?data = dataContainer.containerOne; /* FIX: validate that data is non-null */ if (data != null) { IO.WriteLine("" + data.ToString()); } else { IO.WriteLine("data is null"); } }