Skip to content

Commit c74efd1

Browse files
committed
only allow alphanumeric input keys.
1 parent ebfb4ff commit c74efd1

File tree

1 file changed

+3
-2
lines changed
  • secure_boot_and_secure_firmware_upgrade_over_canfd/icsp_inhibit.X

1 file changed

+3
-2
lines changed

secure_boot_and_secure_firmware_upgrade_over_canfd/icsp_inhibit.X/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <stdio.h>
3434
#include <string.h>
3535
#include <stdbool.h>
36+
#include <ctype.h>
3637

3738
#define USER_INPUT_BUFFER_SIZE 50
3839
#define UNLOCK_COMMAND "LOCKDEVICE"
@@ -84,7 +85,7 @@ int main(void)
8485

8586
PrintWarning();
8687

87-
while (1)
88+
while(1)
8889
{
8990
char* userInput = ScanInput();
9091

@@ -124,7 +125,7 @@ static char* ScanInput(void)
124125
ResetPrompt();
125126
}
126127

127-
if((key != ENTER) && (userInputOffset < sizeof(userInput)))
128+
if(isalnum(key) && (userInputOffset < sizeof(userInput)))
128129
{
129130
userInput[userInputOffset++] = key;
130131
printf("%c", key);

0 commit comments

Comments
 (0)