/* goodB2G1() - use badsource and goodsink by setting the static variable to false instead of true */ private void GoodB2G1(HttpRequest req, HttpResponse resp) { int data = 0; data = int.MinValue; /* 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 */ string stringNumber = cookieSources[0].Value; try { data = int.Parse(stringNumber.Trim()); } catch (FormatException exceptNumberFormat) { IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, "Number format exception reading data from cookie"); } } } goodB2G1PublicStatic = false; CWE191_Integer_Underflow__int_Get_Cookies_Web_sub_22b.GoodB2G1Sink(data, req, resp); }