/* goodG2B() - use goodsource and badsink */ private static void GoodG2B(HttpRequest req, HttpResponse resp) { string data; /* FIX: Use a hardcoded string */ data = "foo"; Container dataContainer = new Container(); dataContainer.containerOne = data; CWE89_SQL_Injection__Web_ReadLine_ExecuteScalar_67b.GoodG2BSink(dataContainer, req, resp); }
/* goodB2G() - use badsource and goodsink */ private static void GoodB2G(HttpRequest req, HttpResponse resp) { string data; data = ""; /* Initialize data */ { /* read user input from console with ReadLine */ try { /* POTENTIAL FLAW: Read data from the console using ReadLine */ data = Console.ReadLine(); } catch (IOException exceptIO) { IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, "Error with stream reading"); } } Container dataContainer = new Container(); dataContainer.containerOne = data; CWE89_SQL_Injection__Web_ReadLine_ExecuteScalar_67b.GoodB2GSink(dataContainer, req, resp); }