/* goodB2G() - use badsource and goodsink */ public void goodB2G_sink() throws Throwable { StringBuilder data = CWE476_NULL_Pointer_Dereference__StringBuilder_68a.data; /* FIX: validate that data is non-null */ if (data != null) { IO.writeLine("" + data.length()); } else { IO.writeLine("data is null"); } }
/* goodG2B() - use goodsource and badsink */ public void goodG2B_sink() throws Throwable { StringBuilder data = CWE476_NULL_Pointer_Dereference__StringBuilder_68a.data; /* POTENTIAL FLAW: null dereference will occur if data is null */ IO.writeLine("" + data.length()); }