1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 23:08:14 +00:00

legacy: explicitly initialize variable length arrays

This commit is contained in:
Ondřej Vejpustek 2019-10-02 15:21:33 +02:00 committed by Pavol Rusnak
parent 08265cdd08
commit fa9d349bc9
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 4 additions and 0 deletions

View File

@ -574,6 +574,7 @@ void layoutAddress(const char *address, const char *desc, bool qrcode,
uint32_t addrlen = strlen(address);
if (qrcode) {
char address_upcase[addrlen + 1];
memset(address_upcase, 0, sizeof(address_upcase));
if (ignorecase) {
for (uint32_t i = 0; i < addrlen + 1; i++) {
address_upcase[i] = address[i] >= 'a' && address[i] <= 'z'

View File

@ -210,6 +210,7 @@ bool nem_askTransfer(const NEMTransactionCommon *common,
bool unknownMosaic = false;
const NEMMosaicDefinition *definitions[transfer->mosaics_count];
memset(definitions, 0, sizeof(definitions));
for (size_t i = 0; i < transfer->mosaics_count; i++) {
const NEMMosaic *mosaic = &transfer->mosaics[i];

View File

@ -1339,6 +1339,8 @@ size_t stellar_publicAddressAsStr(const uint8_t *bytes, char *out,
// version + key bytes + checksum
uint8_t keylen = 1 + 32 + 2;
uint8_t bytes_full[keylen];
memset(bytes_full, 0, sizeof(bytes_full));
bytes_full[0] = 6 << 3; // 'G'
memcpy(bytes_full + 1, bytes, 32);