ask-password: erase character read with _cleanup_

This is much nicer, since it means we erase the character regardless how
we exit the scope.
This commit is contained in:
Lennart Poettering
2019-03-20 10:48:33 +01:00
parent d5d1ae153f
commit e1ed99c8c8
2 changed files with 6 additions and 4 deletions
+5
View File
@@ -77,3 +77,8 @@ static inline void* explicit_bzero_safe(void *p, size_t l) {
#else
void *explicit_bzero_safe(void *p, size_t l);
#endif
/* Use with _cleanup_ to erase a single 'char' when leaving scope */
static inline void erase_char(char *p) {
explicit_bzero_safe(p, sizeof(char));
}