From 90e9da2566dea4fdd460e6ba110aa5a641ba0e66 Mon Sep 17 00:00:00 2001 From: marshmellow42 Date: Mon, 10 Apr 2017 11:38:11 -0400 Subject: [PATCH 1/1] fix length test thanks @pwpiwi for catching what i missed. --- client/cmddata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/cmddata.c b/client/cmddata.c index 2f508efc..823da9ce 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -40,8 +40,8 @@ void setDemodBuf(uint8_t *buff, size_t size, size_t startIdx) if (buff == NULL) return; - if ( size + startIdx >= MAX_DEMOD_BUF_LEN) - size = MAX_DEMOD_BUF_LEN; + if ( size > MAX_DEMOD_BUF_LEN - startIdx) + size = MAX_DEMOD_BUF_LEN - startIdx; size_t i = 0; for (; i < size; i++){ -- 2.39.5