From 1bf2526c34077a243b9489c2a93063ef79326fed Mon Sep 17 00:00:00 2001 From: merlokk Date: Tue, 6 Feb 2018 13:49:03 +0200 Subject: [PATCH] fixed len --- common/parity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/parity.h b/common/parity.h index bceb9cf2..c574db55 100644 --- a/common/parity.h +++ b/common/parity.h @@ -23,7 +23,7 @@ static inline bool oddparity8(const uint8_t x) { } static inline void oddparitybuf(const uint8_t *x, size_t len, uint8_t *parity) { - memset(parity, 0x00, len / 8 + 1); + memset(parity, 0x00, (len - 1) / 8 + 1); for (int i = 0; i < len; i++) parity[i / 8] |= oddparity8(x[i]) << (7 - (i % 8)); }