mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix undefined behavior via invalid TCP analyzer cast
A connection's root analyzer isn't necessarily TCP and an unchecked C-style cast is undefined behavior in those cases.
This commit is contained in:
parent
0f5082585d
commit
2e9f6bec76
1 changed files with 2 additions and 2 deletions
|
@ -1051,9 +1051,9 @@ void NetSessions::Remove(Connection* c)
|
|||
{
|
||||
c->CancelTimers();
|
||||
|
||||
analyzer::tcp::TCP_Analyzer* ta = (analyzer::tcp::TCP_Analyzer*) c->GetRootAnalyzer();
|
||||
if ( ta && c->ConnTransport() == TRANSPORT_TCP )
|
||||
if ( c->ConnTransport() == TRANSPORT_TCP )
|
||||
{
|
||||
auto ta = static_cast<analyzer::tcp::TCP_Analyzer*>(c->GetRootAnalyzer());
|
||||
assert(ta->IsAnalyzer("TCP"));
|
||||
analyzer::tcp::TCP_Endpoint* to = ta->Orig();
|
||||
analyzer::tcp::TCP_Endpoint* tr = ta->Resp();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue