Skip to content

Commit

Permalink
Fix crash caused by reading beyond the buffer. (#33449)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored May 14, 2024
1 parent 4299e18 commit c7f7984
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ bool HandleNullableOptional(Argument & arg, char * argValue, std::function<bool(
if (arg.isNullable())
{
auto * nullable = reinterpret_cast<chip::app::DataModel::Nullable<T> *>(arg.value);
if (strcmp(argValue, "null") == 0)
if (argValue != nullptr && strncmp(argValue, "null", 4) == 0)
{
nullable->SetNull();
return true;
Expand Down

0 comments on commit c7f7984

Please sign in to comment.