Skip to content

Commit

Permalink
Log error on bad packets instead of silent return (#20126)
Browse files Browse the repository at this point in the history
* Log error on bad packets instead of silent return

* update message text

* fix typo
  • Loading branch information
andy31415 authored and pull[bot] committed Aug 30, 2023
1 parent a2886c0 commit 4427059
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/transport/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,12 @@ void SessionManager::OnMessageReceived(const PeerAddress & peerAddress, System::
CHIP_TRACE_PREPARED_MESSAGE_RECEIVED(&peerAddress, &msg);
PacketHeader packetHeader;

ReturnOnFailure(packetHeader.DecodeAndConsume(msg));
CHIP_ERROR err = packetHeader.DecodeAndConsume(msg);
if (err != CHIP_NO_ERROR)
{
ChipLogError(Inet, "Failed to decode packet header: %" CHIP_ERROR_FORMAT, err.Format());
return;
}

if (packetHeader.IsEncrypted())
{
Expand Down

0 comments on commit 4427059

Please sign in to comment.