From a86315160b6d536b38452f9408d2ccfd16313c19 Mon Sep 17 00:00:00 2001 From: Clarence Date: Mon, 13 Sep 2021 17:58:56 +0800 Subject: [PATCH] tls: add tcp segment check --- src/packet/packet_tls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/packet/packet_tls.c b/src/packet/packet_tls.c index ba63aae..70d07f6 100644 --- a/src/packet/packet_tls.c +++ b/src/packet/packet_tls.c @@ -799,6 +799,9 @@ packet_tls_process_record(SSLConnection *conn, GBytes *data, GBytes **out) // Process record fragment if (UINT16_INT(record.length) > 0) { + if (UINT16_INT(record.length) > (int) g_bytes_get_size(data)) { + return g_bytes_offset(data, g_bytes_get_size(data)); + } // TLSPlaintext fragment pointer g_autoptr(GBytes) fragment = g_bytes_new(g_bytes_get_data(data, NULL), g_bytes_get_size(data)); data = g_bytes_offset(data, UINT16_INT(record.length));