Browse code

core: parser - additioal check for content lenght spanning next line

Daniel-Constantin Mierla authored on 20/09/2021 05:17:27
Showing 1 changed files
... ...
@@ -224,8 +224,8 @@ char* parse_content_length(char* const buffer, const char* const end,
224 224
 		goto error;
225 225
 	}
226 226
 	/* search the begining of the number */
227
-	while ( p<end && (*p==' ' || *p=='\t' ||
228
-	(*p=='\n' && (*(p+1)==' '||*(p+1)=='\t')) ))
227
+	while ( p<end && (*p==' ' || *p=='\t'
228
+				|| (*p=='\n' && p+1<end && (*(p+1)==' ' || *(p+1)=='\t')) ) )
229 229
 		p++;
230 230
 	if (p==end)
231 231
 		goto error;