1
0
mirror of https://github.com/rtbrick/bngblaster.git synced 2024-05-06 15:54:57 +00:00

use 63/64 bit arithmethic, such that Fletcher checksum calculation does not overflow beyond 5803 bytes.

This commit is contained in:
Hannes Gredler
2024-01-19 12:18:32 +00:00
parent b1bdce931e
commit 0f044e2289

View File

@@ -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;