/* 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); }
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); }
/* 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"); } }