4
0
Эх сурвалжийг харах

Fix deadloop if header not matched

If end-delimiter of header if not found within the page the loop will never
stop. Only to be terminated by the timeout alarm trigger.

Technically the response is received, yet it might not be valid.
Rick van der Zwet 6 жил өмнө
parent
commit
140679b064

+ 1 - 1
plugins/check_http.c

@@ -1205,7 +1205,7 @@ check_http (void)
 
 
   /* find header info and null-terminate it */
   /* find header info and null-terminate it */
   header = page;
   header = page;
-	for (;;) {
+	while (strlen(page)) {
 		if (!strncmp(page, "\r\n\r\n", 4) || !strncmp(page, "\n\n", 2))
 		if (!strncmp(page, "\r\n\r\n", 4) || !strncmp(page, "\n\n", 2))
 		 break;
 		 break;
 		while (*page == '\r' || *page == '\n') { ++page; }
 		while (*page == '\r' || *page == '\n') { ++page; }