From c7f7984d7a00dd8f701ee5626533aad2632cec68 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 14 May 2024 21:31:45 +0000 Subject: [PATCH] Fix crash caused by reading beyond the buffer. (#33449) --- examples/chip-tool/commands/common/Command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index 2c4f1eb3540e9f..1dff5e83f666b5 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -171,7 +171,7 @@ bool HandleNullableOptional(Argument & arg, char * argValue, std::function *>(arg.value); - if (strcmp(argValue, "null") == 0) + if (argValue != nullptr && strncmp(argValue, "null", 4) == 0) { nullable->SetNull(); return true;