From fa9d349bc9c9172c7acf08a9a4d0c316b7ea2778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Wed, 2 Oct 2019 15:21:33 +0200 Subject: [PATCH] legacy: explicitly initialize variable length arrays --- legacy/firmware/layout2.c | 1 + legacy/firmware/nem2.c | 1 + legacy/firmware/stellar.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/legacy/firmware/layout2.c b/legacy/firmware/layout2.c index 7802ece2c8..e482a80e3c 100644 --- a/legacy/firmware/layout2.c +++ b/legacy/firmware/layout2.c @@ -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' diff --git a/legacy/firmware/nem2.c b/legacy/firmware/nem2.c index 74271765a8..102808c40d 100644 --- a/legacy/firmware/nem2.c +++ b/legacy/firmware/nem2.c @@ -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]; diff --git a/legacy/firmware/stellar.c b/legacy/firmware/stellar.c index ccfd794f44..3607104f70 100644 --- a/legacy/firmware/stellar.c +++ b/legacy/firmware/stellar.c @@ -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);