Skip to content

Commit

Permalink
extkeys: Correct memset zeroing in extkeys_initialize_keyset()
Browse files Browse the repository at this point in the history
sizeof(100) will evaluate to 4, so this wasn't zeroing out the whole
array (which is likely what was intended here). Instead, we can use a
braced initializer to perform the desirable behavior here.
  • Loading branch information
lioncash committed Aug 12, 2018
1 parent bdbd4f6 commit 4719beb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions extkeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,7 @@ void extkeys_initialize_keyset(nca_keyset_t *keyset, FILE *f) {
pki_set_beta_nca0_exponent(exponent);
matched_key = 1;
} else {
char test_name[0x100];
memset(test_name, 0, sizeof(100));
char test_name[0x100] = {0};
for (unsigned int i = 0; i < 0x20 && !matched_key; i++) {
snprintf(test_name, sizeof(test_name), "keyblob_key_source_%02"PRIx32, i);
if (strcmp(key, test_name) == 0) {
Expand Down

0 comments on commit 4719beb

Please sign in to comment.