diff options
author | Jack Lloyd <[email protected]> | 2018-05-08 19:33:31 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-05-08 19:37:56 -0400 |
commit | f92af552e095f217e12538fd05b3d9877cec6cc1 (patch) | |
tree | 8c45dc85947f2d4925b2f49700bd2b55013a99b9 | |
parent | cc2b24f85695653a3a6701339ffc57e76b2f1c60 (diff) |
Slight refactoring to avoid GCC signed overflow warnings. [ci skip]
Couldn't occur since length is 24 bits but GCC couldn't figure that out.
-rw-r--r-- | src/lib/tls/tls_handshake_io.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/tls/tls_handshake_io.cpp b/src/lib/tls/tls_handshake_io.cpp index ec9ae16f1..af97c2545 100644 --- a/src/lib/tls/tls_handshake_io.cpp +++ b/src/lib/tls/tls_handshake_io.cpp @@ -83,16 +83,16 @@ Stream_Handshake_IO::get_next_record(bool) { if(m_queue.size() >= 4) { - const size_t length = make_uint32(0, m_queue[1], m_queue[2], m_queue[3]); + const size_t length = 4 + make_uint32(0, m_queue[1], m_queue[2], m_queue[3]); - if(m_queue.size() >= length + 4) + if(m_queue.size() >= length) { Handshake_Type type = static_cast<Handshake_Type>(m_queue[0]); std::vector<uint8_t> contents(m_queue.begin() + 4, - m_queue.begin() + 4 + length); + m_queue.begin() + length); - m_queue.erase(m_queue.begin(), m_queue.begin() + 4 + length); + m_queue.erase(m_queue.begin(), m_queue.begin() + length); return std::make_pair(type, contents); } |