mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 12:00:59 +00:00
fix(core): ensure proper handling of vendor string
[no changelog]
This commit is contained in:
parent
a44c660ccc
commit
f54edd0d6a
@ -83,15 +83,17 @@ secbool firmware_get_vendor(char* buff, size_t buff_size) {
|
|||||||
|
|
||||||
vendor_header vhdr = {0};
|
vendor_header vhdr = {0};
|
||||||
|
|
||||||
|
memset(buff, 0, buff_size);
|
||||||
|
|
||||||
if (data == NULL || sectrue != read_vendor_header(data, &vhdr)) {
|
if (data == NULL || sectrue != read_vendor_header(data, &vhdr)) {
|
||||||
return secfalse;
|
return secfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buff == NULL || buff_size < vhdr.vstr_len + 1) {
|
if (buff_size < vhdr.vstr_len + 1) {
|
||||||
return secfalse;
|
return secfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(buff, vhdr.vstr, buff_size);
|
memcpy(buff, vhdr.vstr, vhdr.vstr_len);
|
||||||
|
|
||||||
return sectrue;
|
return sectrue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user