Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[openthread] Fixed potential usage fault (#33434) #33440

Merged
merged 1 commit into from
May 14, 2024
Merged
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
[openthread] Fixed potential usage fault (#33434)
Pointer to the ThreadDiagnosticsDelegate is used without a null
check. It leads to the usage fault, if ThreadNetworkDiagnostics
cluster is disabled and pointer is set to nullptr.
kkasperczyk-no committed May 14, 2024
commit 2db44eba7013c2b7a104cf52e1a3f4e4cf8e03be
Original file line number Diff line number Diff line change
@@ -227,18 +227,22 @@ void GenericThreadStackManagerImpl_OpenThread<ImplClass>::_OnPlatformEvent(const

ThreadDiagnosticsDelegate * delegate = GetDiagnosticDataProvider().GetThreadDiagnosticsDelegate();

if (mIsAttached)
if (delegate)
{
delegate->OnConnectionStatusChanged(app::Clusters::ThreadNetworkDiagnostics::ConnectionStatusEnum::kConnected);
}
else
{
delegate->OnConnectionStatusChanged(app::Clusters::ThreadNetworkDiagnostics::ConnectionStatusEnum::kNotConnected);
if (mIsAttached)
{
delegate->OnConnectionStatusChanged(app::Clusters::ThreadNetworkDiagnostics::ConnectionStatusEnum::kConnected);
}
else
{
delegate->OnConnectionStatusChanged(
app::Clusters::ThreadNetworkDiagnostics::ConnectionStatusEnum::kNotConnected);

GeneralFaults<kMaxNetworkFaults> current;
current.add(to_underlying(chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFaultEnum::kLinkDown));
delegate->OnNetworkFaultChanged(mNetworkFaults, current);
mNetworkFaults = current;
GeneralFaults<kMaxNetworkFaults> current;
current.add(to_underlying(chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFaultEnum::kLinkDown));
delegate->OnNetworkFaultChanged(mNetworkFaults, current);
mNetworkFaults = current;
}
}
}