Skip to content

Commit

Permalink
Bugfix: Clear byte after the last byte of the packet, because otherwi…
Browse files Browse the repository at this point in the history
…se it can be decoded incorrectly when the last data is over the byte boundary.
  • Loading branch information
breaker27 committed Apr 18, 2023
1 parent c58f8c1 commit 10c291c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions firmware/shc_basestation/shc_basestation.c
Expand Up @@ -439,6 +439,10 @@ int main(void)

aes256_decrypt_cbc(bufx, len);

// Set the (len+1)th byte to 0, because the last packet content (from the last byte)
// may be smaller than 8 bits and is read per byte in decode_data.
bufx[len] = 0;

//UART_PUTS("Decrypted bytes: ");
//print_bytearray(bufx, len);

Expand Down

0 comments on commit 10c291c

Please sign in to comment.