in This block of code an int field is defined and initialized to 0 in order to count the number of fields present in the HTTP request; However, it's not used afterward. And it's value is checked to make sure the Maximum number of fields is not exceeded,but the value itself was not updated in the first place; I was expecting to see "field++; " in the code somewhere afterward. So did I miss something or is it a mistake in the source code itself ?
int fields = 0;
haystack = needle + 2;
while (*haystack != '\0')
{
// look for CRLF
needle = strstr(haystack, "\r\n");
if (needle == NULL)
{
break;
}
// ensure field is no longer than LimitRequestFieldSize
if (needle - haystack + 2 > LimitRequestFieldSize)
{
break;
}
// look beyond CRLF
haystack = needle + 2;
}
// if we didn't get to end of message, we must have erred
if (*haystack != '\0')
{
break;
}
// ensure message has no more than LimitRequestFields
if (fields > LimitRequestFields)
{
break;
}
// valid
return true;
}