Skip to content

Commit

Permalink
use 63/64 bit arithmethic, such that Fletcher checksum calculation do…
Browse files Browse the repository at this point in the history
…es not overflow beyond 5803 bytes.
  • Loading branch information
Hannes Gredler committed Jan 19, 2024
1 parent b1bdce9 commit 0f044e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions code/lspgen/src/lspgen_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ lspgen_gen_packet_header(lsdb_ctx_t *ctx, lsdb_node_t *node, lsdb_packet_t *pack
* The checksum field of the passed PDU does not need to be reset to zero.
*/
uint16_t
calculate_fletcher_cksum(const uint8_t *pptr, int checksum_offset, int length)
calculate_fletcher_cksum(const uint8_t *pptr, uint checksum_offset, uint length)
{

int x, y;
uint32_t mul, c0, c1;
int idx;
int64_t x, y;
uint64_t mul, c0, c1;
uint idx;

c0 = 0;
c1 = 0;
Expand Down

0 comments on commit 0f044e2

Please sign in to comment.