global: improve user storage security

This commit is contained in:
King Kévin 2020-02-11 12:15:31 +01:00
parent 7005889f01
commit 4ddf1562fc
2 changed files with 5 additions and 5 deletions

View File

@ -13,9 +13,9 @@
* *
*/ */
/** global definitions and methods (code) /** global definitions and methods (code)
* @file global.c * @file
* @author King Kévin <kingkevin@cuvoodoo.info> * @author King Kévin <kingkevin@cuvoodoo.info>
* @date 2016-2019 * @date 2016-2020
*/ */
/* standard libraries */ /* standard libraries */
#include <stdint.h> // standard integer types #include <stdint.h> // standard integer types
@ -160,7 +160,7 @@ void sys_tick_handler(void)
char user_input_get(void) char user_input_get(void)
{ {
while (!user_input_available) { // wait for user input while (0 == user_input_used) { // wait for user input to be available (don't trust user_input_available since it user modifiable)
__WFI(); // go to sleep __WFI(); // go to sleep
} }
volatile char to_return = user_input_buffer[user_input_i]; // get the next available character volatile char to_return = user_input_buffer[user_input_i]; // get the next available character

View File

@ -13,9 +13,9 @@
* *
*/ */
/** global definitions and methods (API) /** global definitions and methods (API)
* @file global.h * @file
* @author King Kévin <kingkevin@cuvoodoo.info> * @author King Kévin <kingkevin@cuvoodoo.info>
* @date 2016-2019 * @date 2016-2020
*/ */
#pragma once #pragma once