From 7c763f67a67e5deb43c538311e2b3119b7e79c89 Mon Sep 17 00:00:00 2001 From: makejian Date: Tue, 19 Dec 2023 21:21:38 +0800 Subject: [PATCH] crypto/poly1305: Fix false positive '-Wstringop-overflow' warning in poly1305.c poly1305.c:241:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 241 | st->buffer[st->leftover + i] = m[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ Signed-off-by: makejian --- crypto/poly1305.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/poly1305.c b/crypto/poly1305.c index fa0b810879..94c206b695 100644 --- a/crypto/poly1305.c +++ b/crypto/poly1305.c @@ -236,9 +236,9 @@ void poly1305_update(FAR poly1305_state *st, if (bytes) { - for (i = 0; i < bytes; i++) + for (i = 0; i < bytes && i < poly1305_block_size; i++) { - st->buffer[st->leftover + i] = m[i]; + st->buffer[i] = m[i]; } st->leftover += bytes;