tls: add tcp segment check

This commit is contained in:
Clarence 2021-09-13 17:58:56 +08:00 committed by Kaian
parent 3f7659eee9
commit a86315160b
1 changed files with 3 additions and 0 deletions

View File

@ -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));