X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=httpinput.cpp;h=a3a950b03a9876c33fbd1de794e25549eea0b7c9;hp=6de67b251cc4b132c75146b7a2927dda541205f3;hb=c73067960fde76968fc7b460064277d93be2c05f;hpb=9ec4c94b5d2071b1eacfe09f1cf99824bb8e3868 diff --git a/httpinput.cpp b/httpinput.cpp index 6de67b2..a3a950b 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -352,7 +352,7 @@ void HTTPInput::do_work() char *ptr = static_cast( memmem(response.data(), response.size(), "\r\n\r\n", 4)); assert(ptr != NULL); - extra_data = string(ptr, &response[0] + response.size()); + extra_data = string(ptr + 4, &response[0] + response.size()); response.resize(ptr - response.data()); } @@ -458,6 +458,11 @@ void HTTPInput::process_data(char *ptr, size_t bytes) uint32_t size = ntohl(hdr->size); uint32_t flags = ntohl(hdr->flags); + if (size > 65535) { + log(WARNING, "[%s] Metacube block of %x bytes (flags=%x); corrupted header?", + url.c_str(), size, flags); + } + // See if we have the entire block. If not, wait for more data. if (pending_data.size() < sizeof(metacube_block_header) + size) { return;