fix bugs in SW
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-11-17 11:45:09 +01:00
parent bb66228837
commit 53535b6023
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -67,6 +67,7 @@ int hdlc_remove_framing_with_crc_check(const uint8_t *src, size_t slen, uint8_t
*dlen = 0; *dlen = 0;
if (slen < 4) return -1; if (slen < 4) return -1;
if ((src[tlen] != 0x7E) && (src[slen-1] != 0x7C)) return -2; if ((src[tlen] != 0x7E) && (src[slen-1] != 0x7C)) return -2;
src++;
for (ii = 1; ii < slen-1; ii++) for (ii = 1; ii < slen-1; ii++)
{ {
bt = *src++; bt = *src++;
@ -74,6 +75,7 @@ int hdlc_remove_framing_with_crc_check(const uint8_t *src, size_t slen, uint8_t
if (bt == 0x7D) if (bt == 0x7D)
{ {
bt = *src++ ^ 0x20; bt = *src++ ^ 0x20;
ii++;
} }
dst[tlen++] = bt; dst[tlen++] = bt;
} }