Enforce correct length of target string constraints in strncpy().
Clang did warn about these. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1438 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
60529b4e50
commit
b23c506cbd
|
@ -1,3 +1,8 @@
|
|||
2020-09-10 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* config_gram.y (K_DESC): Enforce correct length in strncpy()
|
||||
* config_gram.y (K_MEMORY): (Dito.)
|
||||
|
||||
2020-09-10 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrpart.c (avr_new_memtype): ensure page_size is at least 1
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue