Skip to content

Commit

Permalink
legacy: explicitly initialize variable length arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
onvej-sl authored and prusnak committed Oct 9, 2019
1 parent 08265cd commit fa9d349
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions legacy/firmware/layout2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions legacy/firmware/nem2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 2 additions & 0 deletions legacy/firmware/stellar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fa9d349

Please sign in to comment.