From: Yeonggi Kim <[email protected]>
ssl_sock_parse_clienthello() loops while "msg + 4 < extensions_end", so
an empty extension placed last is not recorded. For example
"openssl s_client -tls1_1" sends no signature_algorithms, so
extended_master_secret comes last and ssl_fc_extlist_bin reports
FF01000B000A00230016 instead of FF01000B000A002300160017. The loop only
needs room for the 4-byte header, so use "<=".
Same origin as the previous patch (769fd2e44, 2.5). It must be
backported after it, otherwise bytes left at the end of the last
extension, hidden so far by this check, would be parsed as an extension.
---
src/ssl_sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 844484391..87a5493ff 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -2226,7 +2226,7 @@ static void ssl_sock_parse_clienthello(int write_p, int
version,
capture->extensions_offset = offset;
/* Parse each extension */
- while (msg + 4 < extensions_end) {
+ while (msg + 4 <= extensions_end) {
/* Add 2 bytes of extension_id */
if (global_ssl.capture_buffer_size >= offset + 2) {
capture->data[offset++] = msg[0];
--
2.52.0