Skip to content

Commit 1188226

Browse files
bzbarsky-applepull[bot]
authored andcommitted
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 #29218
1 parent 1a9c3d5 commit 1188226

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

src/lib/core/TLVWriter.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,6 @@ CHIP_ERROR TLVWriter::VPutStringF(Tag tag, const char * fmt, va_list ap)
301301
size_t skipLen;
302302
size_t writtenBytes;
303303
#elif CONFIG_HAVE_VCBPRINTF
304-
#elif CONFIG_TLV_TRUNCATE
305-
size_t maxLen;
306304
#else
307305
char * tmpBuf;
308306
#endif
@@ -324,17 +322,6 @@ CHIP_ERROR TLVWriter::VPutStringF(Tag tag, const char * fmt, va_list ap)
324322
else
325323
lenFieldSize = kTLVFieldSize_4Byte;
326324

327-
#if !(CONFIG_HAVE_VCBPRINTF) && !(CONFIG_HAVE_VSNPRINTF_EX) && CONFIG_TLV_TRUNCATE
328-
// no facilities for splitting the stream across multiple buffers,
329-
// just write however much fits in the current buffer.
330-
// assume conservative tag length at this time (8 bytes)
331-
maxLen = mRemainingLen -
332-
(1 + 8 + (1 << static_cast<uint8_t>(lenFieldSize)) +
333-
1); // 1 : control byte, 8 : tag length, stringLen + 1 for null termination
334-
if (maxLen < dataLen)
335-
dataLen = maxLen;
336-
#endif
337-
338325
// write length.
339326
err = WriteElementHead(
340327
static_cast<TLVElementType>(static_cast<uint8_t>(kTLVType_UTF8String) | static_cast<uint8_t>(lenFieldSize)), tag, dataLen);

0 commit comments

Comments
 (0)