Skip to content

Commit

Permalink
encoding/base64: Fix compilation warning with ARM GCC 13
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sjanc committed Oct 6, 2023
1 parent 25cd4af commit a87c17d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions encoding/base64/src/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include <assert.h>

#include <os/mynewt.h>
#include <base64/base64.h>
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit a87c17d

Please sign in to comment.