summaryrefslogtreecommitdiffstats
path: root/movement/filesystem.c
diff options
context:
space:
mode:
authorMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>2024-03-20 11:35:58 -0300
committerMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>2024-03-20 12:54:20 -0300
commit10701f3d505170f57655b111c77977f270fe9e42 (patch)
tree6e9697a7ae91c1c5e004e77aa0aedca432a93002 /movement/filesystem.c
parent7e5c34773a4e8a47c2f8e77bd5c7ec58f4a7a84c (diff)
downloadSensor-Watch-10701f3d505170f57655b111c77977f270fe9e42.tar.gz
Sensor-Watch-10701f3d505170f57655b111c77977f270fe9e42.tar.bz2
Sensor-Watch-10701f3d505170f57655b111c77977f270fe9e42.zip
faces/totp: avoid displaying when key is invalid
Fixes a division by zero bug caused by calling getCodeFromTimestamp without having initialized the TOTP library with a secret first. This was happening because the face calls totp_display on activation, meaning the validity of the secret was not checked since this is done in the generate function. Now the validity of the key is determined solely by the size of the current decoded key. A general display function checks it and decides whether to display the code or just the error message. The size of the current decoded key is initialized to zero on watch face activation, ensuring fail safe operation. Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> Tested-on-hardware-by: madhogs <59648482+madhogs@users.noreply.github.com> Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/385
Diffstat (limited to 'movement/filesystem.c')
0 files changed, 0 insertions, 0 deletions