From a77777fb295eaf0029bf1629289d4a1c53d0234d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 14 Sep 2023 03:36:05 -0400 Subject: [PATCH] Remove CONFIG_TLV_TRUNCATE. (#29233) It's not used right now, and it silently truncates the data being encoded, so should not be used. Fixes https://github.com/project-chip/connectedhomeip/issues/29218 --- src/lib/core/TLVWriter.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/lib/core/TLVWriter.cpp b/src/lib/core/TLVWriter.cpp index 41bfcfd4bc2c65..5249e0b4789f7a 100644 --- a/src/lib/core/TLVWriter.cpp +++ b/src/lib/core/TLVWriter.cpp @@ -301,8 +301,6 @@ CHIP_ERROR TLVWriter::VPutStringF(Tag tag, const char * fmt, va_list ap) size_t skipLen; size_t writtenBytes; #elif CONFIG_HAVE_VCBPRINTF -#elif CONFIG_TLV_TRUNCATE - size_t maxLen; #else char * tmpBuf; #endif @@ -324,17 +322,6 @@ CHIP_ERROR TLVWriter::VPutStringF(Tag tag, const char * fmt, va_list ap) else lenFieldSize = kTLVFieldSize_4Byte; -#if !(CONFIG_HAVE_VCBPRINTF) && !(CONFIG_HAVE_VSNPRINTF_EX) && CONFIG_TLV_TRUNCATE - // no facilities for splitting the stream across multiple buffers, - // just write however much fits in the current buffer. - // assume conservative tag length at this time (8 bytes) - maxLen = mRemainingLen - - (1 + 8 + (1 << static_cast(lenFieldSize)) + - 1); // 1 : control byte, 8 : tag length, stringLen + 1 for null termination - if (maxLen < dataLen) - dataLen = maxLen; -#endif - // write length. err = WriteElementHead( static_cast(static_cast(kTLVType_UTF8String) | static_cast(lenFieldSize)), tag, dataLen);