/* goodG2B() - use goodsource and badsink */ private void GoodG2B(HttpRequest req, HttpResponse resp) { string data = null; /* FIX: Use a hardcoded string */ data = "foo"; goodG2BPublicStatic = true; CWE113_HTTP_Response_Splitting__Web_QueryString_Web_addCookie_22b.GoodG2BSink(data, req, resp); }
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the if in the sink function */ private void GoodB2G2(HttpRequest req, HttpResponse resp) { string data = null; data = ""; /* initialize data in case id is not in query string */ /* POTENTIAL FLAW: Parse id param out of the URL querystring (without using getParameter()) */ { if (req.QueryString["id"] != null) { data = req.QueryString["id"]; } } goodB2G2PublicStatic = true; CWE113_HTTP_Response_Splitting__Web_QueryString_Web_addCookie_22b.GoodB2G2Sink(data, req, resp); }