1
0
forked from fsfw/fsfw

tests almost complete

This commit is contained in:
2021-09-09 10:47:54 +02:00
parent d05eb23ea7
commit 3d336c08f2
2 changed files with 65 additions and 9 deletions

View File

@ -15,7 +15,7 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream,
else {
minAllowedLen = 2;
}
if(maxDestLen < minAllowedLen) {
if(minAllowedLen > maxDestLen) {
return STREAM_TOO_SHORT;
}
if (addStxEtx) {
@ -123,6 +123,9 @@ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, si
if (sourceIndex == sourceLen and encodedIndex < maxDestLen) {
if (addStxEtx) {
if(encodedIndex + 2 >= maxDestLen) {
return STREAM_TOO_SHORT;
}
destStream[encodedIndex++] = DLE_CHAR;
destStream[encodedIndex++] = ETX_CHAR;
}