string-util: readd string_erase()

This was dropped in 8e27167cc9, but is
actually useful for some usecases still.
This commit is contained in:
Lennart Poettering
2019-12-04 10:58:12 +01:00
parent 282bde1066
commit 53caaffdf4
3 changed files with 36 additions and 0 deletions
+10
View File
@@ -1064,3 +1064,13 @@ bool string_is_safe(const char *p) {
return true;
}
char* string_erase(char *x) {
if (!x)
return NULL;
/* A delicious drop of snake-oil! To be called on memory where we stored passphrases or so, after we
* used them. */
explicit_bzero_safe(x, strlen(x));
return x;
}