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));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Julien Lecoeur 2017-06-28 16:29:54 +02:00 committed by Beat Küng
parent abcb920df4
commit 61d6903b40
1 changed files with 3 additions and 3 deletions

View File

@ -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 {