From 34ae45bbd14019fcdb1178e3ddd3238b860cc018 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 6 Sep 2019 04:46:25 -0400 Subject: [PATCH] Checksums: Correct null check within crc16 This should be checking if the input is null rather than not null before early exiting, otherwise the data itself will never have the checksum calculated. --- src/athena/Checksums.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/athena/Checksums.cpp b/src/athena/Checksums.cpp index 2f69ece..a3ee6cc 100644 --- a/src/athena/Checksums.cpp +++ b/src/athena/Checksums.cpp @@ -145,8 +145,9 @@ atUint16 crc16CCITT(const atUint8* data, atUint64 length, atUint16 seed, atUint1 } atUint16 crc16(const atUint8* data, atUint64 length, atUint16 seed, atUint64 final) { - if (data) + if (data == nullptr) { return seed; + } static const atUint16 crc16Table[256] = { 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1,