From 57d3b0308cb6a1a4f0858757e716963afdef27aa Mon Sep 17 00:00:00 2001 From: BoB13-Matter Date: Fri, 20 Dec 2024 18:02:01 +0900 Subject: [PATCH] Add nullptr check for String TLV data with zero length --- src/lib/support/BufferWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/support/BufferWriter.cpp b/src/lib/support/BufferWriter.cpp index 2ba03e22d24e03..5bbe5a5e722633 100644 --- a/src/lib/support/BufferWriter.cpp +++ b/src/lib/support/BufferWriter.cpp @@ -30,7 +30,7 @@ BufferWriter & BufferWriter::Put(const void * buf, size_t len) { size_t available = Available(); - if (available > 0) + if (available > 0 && buf != nullptr) { memmove(mBuf + mNeeded, buf, available < len ? available : len); }