diff --git a/ChangeLog b/ChangeLog index 1fc31894..e42073b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-09-10 Joerg Wunsch + + * config_gram.y (K_DESC): Enforce correct length in strncpy() + * config_gram.y (K_MEMORY): (Dito.) + 2020-09-10 Joerg Wunsch * avrpart.c (avr_new_memtype): ensure page_size is at least 1 diff --git a/config_gram.y b/config_gram.y index d9f661a1..468706e5 100644 --- a/config_gram.y +++ b/config_gram.y @@ -672,7 +672,7 @@ part_parm : K_DESC TKN_EQUAL TKN_STRING { - strncpy(current_part->desc, $3->value.string, AVR_DESCLEN); + strncpy(current_part->desc, $3->value.string, AVR_DESCLEN - 1); current_part->desc[AVR_DESCLEN-1] = 0; free_token($3); } | @@ -1240,7 +1240,7 @@ part_parm : free_token($2); YYABORT; } - strncpy(current_mem->desc, $2->value.string, AVR_MEMDESCLEN); + strncpy(current_mem->desc, $2->value.string, AVR_MEMDESCLEN - 1); current_mem->desc[AVR_MEMDESCLEN-1] = 0; free_token($2); }