Преглед изворни кода

(Handles #535) check_http: Ensure that trailing null byte is copied to full_page_new (gets overwritten each loop iteration)

madlohe пре 6 година
родитељ
комит
fca9b3259b
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      plugins/check_http.c

+ 2 - 2
plugins/check_http.c

@@ -1195,7 +1195,7 @@ check_http (void)
         if ((full_page_new = realloc(full_page, pagesize + i + 1)) == NULL)
         if ((full_page_new = realloc(full_page, pagesize + i + 1)) == NULL)
             die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate memory for full_page\n"));
             die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate memory for full_page\n"));
 
 
-        memmove(&full_page_new[pagesize], buffer, i);
+        memmove(&full_page_new[pagesize], buffer, i + 1);
         /*free (full_page);*/
         /*free (full_page);*/
         full_page = full_page_new;
         full_page = full_page_new;
         pagesize += i;
         pagesize += i;
@@ -1226,7 +1226,7 @@ check_http (void)
 
 
             if ((full_page_new = realloc(full_page, pagesize + i + 1)) == NULL)
             if ((full_page_new = realloc(full_page, pagesize + i + 1)) == NULL)
                 die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate memory for full_page\n"));
                 die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate memory for full_page\n"));
-            memmove(&full_page_new[pagesize], buffer, i);
+            memmove(&full_page_new[pagesize], buffer, i + 1);
             full_page = full_page_new;
             full_page = full_page_new;
 
 
             pagesize += i;
             pagesize += i;