Assert that packet is inside the buffer

The buffer containing the response should contain only complete packets.
This commit is contained in:
Markus Mäkelä 2019-06-25 08:40:50 +03:00
parent a51e094cd5
commit 873ea92915
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -293,6 +293,7 @@ void RWBackend::process_packets(GWBUF* result)
len |= (*it++) << 16;
++it; // Skip the sequence
mxb_assert(it != buffer.end());
mxb_assert(std::distance(it, buffer.end()) >= len);
auto end = it;
end.advance(len);
uint8_t cmd = *it;