treewide: replace homegrown memory_erase with explicit_bzero

explicit_bzero was added in glibc 2.25. Make use of it.

explicit_bzero is hardcoded to zero the memory, so string erase now
truncates the string, instead of overwriting it with 'x'. This causes
a visible difference only in the journalctl case.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-02-05 21:07:55 -05:00
parent 52e634271f
commit 2d26d8e07e
7 changed files with 33 additions and 38 deletions
+4 -1
View File
@@ -189,7 +189,10 @@ static inline void *memmem_safe(const void *haystack, size_t haystacklen, const
return memmem(haystack, haystacklen, needle, needlelen);
}
void* memory_erase(void *p, size_t l);
#if !HAVE_DECL_EXPLICIT_BZERO
void explicit_bzero(void *p, size_t l);
#endif
char *string_erase(char *x);
char *string_free_erase(char *s);