path: root/src/basic/string-util.h
diff options
authorZbigniew Jędrzejewski-Szmek <>2017-02-05 20:05:27 -0500
committerSven Eden <>2017-07-17 17:58:36 +0200
commit9270bff168ecc98d1761a32ca28b1f3906b093f2 (patch)
tree7e06883e6f9701c7b192689b6adedd4632855c49 /src/basic/string-util.h
parent85df5c16a4d10d955b204d9296827e108c0216a0 (diff)
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.
Diffstat (limited to 'src/basic/string-util.h')
1 files changed, 4 insertions, 1 deletions
diff --git a/src/basic/string-util.h b/src/basic/string-util.h
index 668b63907..38c7c1009 100644
--- a/src/basic/string-util.h
+++ b/src/basic/string-util.h
@@ -197,7 +197,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);
+void explicit_bzero(void *p, size_t l);
char *string_erase(char *x);
char *string_free_erase(char *s);