Browse Source

Fix -Werror=stringop-overflow on gcc 7

The error was:
Firmware/src/systemcmds/hardfault_log/hardfault_log.c:312:7: error: specified bound 30 equals the size of the destination [-Werror=stringop-overflow=]
       strncat(marker, sp_name, sizeof(marker));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sbg
Julien Lecoeur 8 years ago committed by Beat Küng
parent
commit
61d6903b40
  1. 6
      src/systemcmds/hardfault_log/hardfault_log.c

6
src/systemcmds/hardfault_log/hardfault_log.c

@ -311,16 +311,16 @@ static int write_stack(bool inValid, int winsize, uint32_t wtopaddr, @@ -311,16 +311,16 @@ static int write_stack(bool inValid, int winsize, uint32_t wtopaddr,
for (int i = 0; i < chunk; i++) {
if (wtopaddr == topaddr) {
strncpy(marker, "<-- ", sizeof(marker));
strncat(marker, sp_name, sizeof(marker));
strncat(marker, sp_name, sizeof(marker) - 1);
strncat(marker, " top", sizeof(marker));
} else if (wtopaddr == spaddr) {
strncpy(marker, "<-- ", sizeof(marker));
strncat(marker, sp_name, sizeof(marker));
strncat(marker, sp_name, sizeof(marker) - 1);
} else if (wtopaddr == botaddr) {
strncpy(marker, "<-- ", sizeof(marker));
strncat(marker, sp_name, sizeof(marker));
strncat(marker, sp_name, sizeof(marker) - 1);
strncat(marker, " bottom", sizeof(marker));
} else {

Loading…
Cancel
Save