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:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user