Skip to content

Commit

Permalink
tls: redo fix infinite loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
azzbcc authored and Kaian committed Sep 22, 2021
1 parent 1b18bde commit 3f7659e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/packet/packet_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ packet_tls_process_record_handshake(SSLConnection *conn, GBytes *data)
}

static GBytes *
packet_tls_process_record(SSLConnection *conn, GBytes *data)
packet_tls_process_record(SSLConnection *conn, GBytes *data, GBytes **out)
{
// No record data here!
if (g_bytes_get_size(data) == 0)
Expand Down Expand Up @@ -821,7 +821,7 @@ packet_tls_process_record(SSLConnection *conn, GBytes *data)
case APPLICATION_DATA:
if (conn->encrypted) {
// Decrypt application data using MasterSecret
return packet_tls_process_record_decode(conn, fragment);
*out = packet_tls_process_record_decode(conn, fragment);
}
break;
default:
Expand Down Expand Up @@ -887,13 +887,12 @@ packet_dissector_tls_dissect(PacketDissector *self, Packet *packet, GBytes *data
} else {
// Process data segment!
while (g_bytes_get_size(data) > 0) {
out = packet_tls_process_record(conn, data);
if (out == NULL) {
data = packet_tls_process_record(conn, data, &out);
if (data == NULL) {
dissector->connections = g_slist_remove(dissector->connections, conn);
packet_tls_connection_destroy(conn);
break;
}
data = out;
}
}

Expand Down

0 comments on commit 3f7659e

Please sign in to comment.