Skip to content

Commit

Permalink
fix(core): ensure proper handling of vendor string
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
cepetr committed Oct 2, 2024
1 parent a44c660 commit f54edd0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/embed/trezorhal/stm32f4/fwutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,17 @@ secbool firmware_get_vendor(char* buff, size_t buff_size) {

vendor_header vhdr = {0};

memset(buff, 0, buff_size);

if (data == NULL || sectrue != read_vendor_header(data, &vhdr)) {
return secfalse;
}

if (buff == NULL || buff_size < vhdr.vstr_len + 1) {
if (buff_size < vhdr.vstr_len + 1) {
return secfalse;
}

strncpy(buff, vhdr.vstr, buff_size);
memcpy(buff, vhdr.vstr, vhdr.vstr_len);

return sectrue;
}
Expand Down

0 comments on commit f54edd0

Please sign in to comment.