This is much nicer, since it means we erase the character regardless how
we exit the scope.
#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));
+}
};
for (;;) {
+ _cleanup_(erase_char) char c;
int sleep_for = -1, k;
ssize_t n;
- char c;
if (until > 0) {
usec_t y;
dirty = true;
}
-
- /* Let's forget this char, just to not keep needlessly copies of key material around */
- c = 'x';
}
x = strndup(passphrase, p);