From 38ede4293096dc1ebab373d4ae7831d09c6c9a87 Mon Sep 17 00:00:00 2001 From: shripad621git <79364691+shripad621git@users.noreply.github.com> Date: Tue, 3 Sep 2024 20:12:39 +0530 Subject: [PATCH] [v1.3-branch] : Fixed the crash due to packet buffers running out of space in CommandHandlerImpl (#35308) --- src/app/CommandHandler.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index f7acd709b26808..dfad3f4a6186f2 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -327,7 +327,12 @@ class CommandHandler { return CHIP_NO_ERROR; } - ReturnErrorOnFailure(RollbackResponse()); + // The error value of RollbackResponse is not important if it fails, we prioritize + // conveying the error generated by addResponseFunction to the caller. + if (RollbackResponse() != CHIP_NO_ERROR) + { + return err; + } // If we failed to add a command due to lack of space in the // packet, we will make another attempt to add the response using // an additional InvokeResponseMessage.