possible bugfix for DLE encoder

This commit is contained in:
Robin Müller 2021-09-30 11:25:42 +02:00
parent 6e88f8f400
commit b0cbd40e64
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -165,7 +165,7 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_
if (sourceStream[encodedIndex++] != STX_CHAR) {
return DECODING_ERROR;
}
while ((encodedIndex < sourceStreamLen)
while ((encodedIndex < sourceStreamLen - 1)
and (decodedIndex < maxDestStreamlen)
and (sourceStream[encodedIndex] != ETX_CHAR)
and (sourceStream[encodedIndex] != STX_CHAR)) {