1
0
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:
cepetr 2024-10-02 13:07:49 +02:00 committed by cepetr
parent a44c660ccc
commit f54edd0d6a

View File

@ -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;
}