(cherry picked from commit bf6bd11a9b969c02a106f94ebf40cefbe8028456) (cherry picked from commit ecfcab9af6f3927c9dfe170826f1cbae5d28a447)
@@ -224,8 +224,8 @@ char* parse_content_length(char* const buffer, const char* const end,
goto error;
}
/* search the begining of the number */
- while ( p<end && (*p==' ' || *p=='\t' ||
- (*p=='\n' && (*(p+1)==' '||*(p+1)=='\t')) ))
+ while ( p<end && (*p==' ' || *p=='\t'
+ || (*p=='\n' && p+1<end && (*(p+1)==' ' || *(p+1)=='\t')) ) )
p++;
if (p==end)