From a87c17d717249b104e89367f7bf0ea44f2ea90d1 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Fri, 6 Oct 2023 08:58:33 +0200 Subject: [PATCH] encoding/base64: Fix compilation warning with ARM GCC 13 Error: repos/apache-mynewt-core/encoding/base64/src/base64.c: In function 'base64_decoder_go': repos/apache-mynewt-core/encoding/base64/src/base64.c:261:9: error: 'memcpy' specified size between 2147483653 and 4294967295 exceeds maximum object size 2147483647 [-Werror=stringop-overflow=] 261 | memcpy(&dec->buf[dec->buf_len], &dec->src[src_off], read_len); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors --- encoding/base64/src/base64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/encoding/base64/src/base64.c b/encoding/base64/src/base64.c index 51771212ba..83cc7d3173 100644 --- a/encoding/base64/src/base64.c +++ b/encoding/base64/src/base64.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -233,6 +234,7 @@ base64_decoder_go(struct base64_decoder *dec) } /* Account for possibility of partial token from previous call. */ + assert(dec->buf_len < 4); read_len = 4 - dec->buf_len; /* Detect invalid input. */