Skip to content

Commit

Permalink
Don't allow reading off the end of the word_order array
Browse files Browse the repository at this point in the history
  • Loading branch information
keepkeyjon committed Mar 9, 2018
1 parent 3c6aebc commit 018eabc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions keepkey/local/baremetal/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ static char words[24][12];
/* === Functions =========================================================== */

void next_word(void) {
if (sizeof(word_order)/sizeof(word_order[0]) <= word_index) {
fsm_sendFailure(FailureType_Failure_SyntaxError, "Invalid word_index");
go_home();
return;
}

word_pos = word_order[word_index];
char title_formatted[SMALL_STR_BUF];
char body_formatted[MEDIUM_STR_BUF];
Expand Down

0 comments on commit 018eabc

Please sign in to comment.