Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Telepathy/ThreadFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ public static bool ReadMessageBlocking(NetworkStream stream, int MaxMessageSize,
// read exactly 'size' bytes for content (blocking)
return stream.ReadExactly(payloadBuffer, size);
}

//PATCH — Aggressive disconnect, close stream immediately to prevent attacker from sending more data before it closes in ReceiveLoop
try
{
stream.Close(); // drop connection before returning
}
catch (Exception ex)
{
Log.Info("Exception while closing stream after header attack: " + ex);
}

Log.Warning("[Telepathy] ReadMessageBlocking: possible header attack with a header of: " + size + " bytes.");
return false;
}
Expand Down Expand Up @@ -241,4 +252,4 @@ public static void SendLoop(int connectionId, TcpClient client, MagnificentSendP
}
}
}
}
}