/* goodG2B() - use GoodSource and BadSink */ private static void GoodG2B(HttpRequest req, HttpResponse resp) { string data; /* FIX: Use a hardcoded int as a string */ data = "5"; LinkedList <string> dataLinkedList = new LinkedList <string>(); dataLinkedList.AddLast(data); dataLinkedList.AddLast(data); dataLinkedList.AddLast(data); CWE606_Unchecked_Loop_Condition__Get_Cookies_Web_73b.GoodG2BSink(dataLinkedList, req, resp); }
/* goodB2G() - use BadSource and GoodSink */ private static void GoodB2G(HttpRequest req, HttpResponse resp) { string data; data = ""; /* initialize data in case there are no cookies */ /* Read data from cookies */ { HttpCookieCollection cookieSources = req.Cookies; if (cookieSources != null) { /* POTENTIAL FLAW: Read data from the first cookie value */ data = cookieSources[0].Value; } } LinkedList <string> dataLinkedList = new LinkedList <string>(); dataLinkedList.AddLast(data); dataLinkedList.AddLast(data); dataLinkedList.AddLast(data); CWE606_Unchecked_Loop_Condition__Get_Cookies_Web_73b.GoodB2GSink(dataLinkedList, req, resp); }