Skip to content

Commit c7f7984

Browse files
authored
Fix crash caused by reading beyond the buffer. (#33449)
1 parent 4299e18 commit c7f7984

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/chip-tool/commands/common/Command.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ bool HandleNullableOptional(Argument & arg, char * argValue, std::function<bool(
171171
if (arg.isNullable())
172172
{
173173
auto * nullable = reinterpret_cast<chip::app::DataModel::Nullable<T> *>(arg.value);
174-
if (strcmp(argValue, "null") == 0)
174+
if (argValue != nullptr && strncmp(argValue, "null", 4) == 0)
175175
{
176176
nullable->SetNull();
177177
return true;

0 commit comments

Comments
 (0)