From e0b3aa7745e0f9e9be9a73983938d1863e10f98f Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 22 Nov 2018 18:31:57 -0800 Subject: [PATCH] Fix warning in is_ssl_handshake --- CHANGELOG.md | 1 + example/common/detect_ssl.hpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54cd2dc9..ece5d0b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Version 191: * Use mp11 in detail::variant * Fix buffers_cat uninitialized warning * Fix static_string uninitialized warning +* Fix warning in is_ssl_handshake -------------------------------------------------------------------------------- diff --git a/example/common/detect_ssl.hpp b/example/common/detect_ssl.hpp index 8c322996..417226e4 100644 --- a/example/common/detect_ssl.hpp +++ b/example/common/detect_ssl.hpp @@ -67,14 +67,14 @@ is_ssl_handshake( boost::asio::is_const_buffer_sequence::value, "ConstBufferSequence requirements not met"); - // We need at least one byte to really do anything - if(boost::asio::buffer_size(buffers) < 1) - return boost::indeterminate; - // Extract the first byte, which holds the // "message" type for the Handshake protocol. unsigned char v; - boost::asio::buffer_copy(boost::asio::buffer(&v, 1), buffers); + if(boost::asio::buffer_copy(boost::asio::buffer(&v, 1), buffers) < 1) + { + // We need at least one byte to really do anything + return boost::indeterminate; + } // Check that the message type is "SSL Handshake" (rfc2246) if(v != 0x16)