diff options
| author | emersion <contact@emersion.fr> | 2019-01-16 23:35:14 +0100 |
|---|---|---|
| committer | emersion <contact@emersion.fr> | 2019-01-17 09:53:23 +0100 |
| commit | 0c7932a3af97dd0416dc2156dc82dfe0b8e3951d (patch) | |
| tree | c986a2b2ceccfd340a6e844b2db3f9a533865387 /password.c | |
| parent | 0c1f193083166ccc56107028bb8b59d7aa767732 (diff) | |
Move PAM into a child process
Diffstat (limited to 'password.c')
| -rw-r--r-- | password.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -11,13 +11,17 @@ #include "swaylock.h" #include "unicode.h" -void clear_password_buffer(struct swaylock_password *pw) { +void clear_buffer(char *buf, size_t size) { // Use volatile keyword so so compiler can't optimize this out. - volatile char *buffer = pw->buffer; + volatile char *buffer = buf; volatile char zero = '\0'; - for (size_t i = 0; i < sizeof(pw->buffer); ++i) { + for (size_t i = 0; i < size; ++i) { buffer[i] = zero; } +} + +void clear_password_buffer(struct swaylock_password *pw) { + clear_buffer(pw->buffer, sizeof(pw->buffer)); pw->len = 0; } |
