diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-08-20 06:52:03 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-08-20 06:52:03 +0200 |
commit | f6640a80f4be19e988fd7426c3f897f4d3f614e4 (patch) | |
tree | 3b6764fc547ee9ea1559ed1fb2c9b4fd4eb0726a /src/fastd.h | |
parent | d9dc87d8409ddf8361b7fcb311ae97088ed1d984 (diff) | |
download | fastd-f6640a80f4be19e988fd7426c3f897f4d3f614e4.tar fastd-f6640a80f4be19e988fd7426c3f897f4d3f614e4.zip |
Prevent zero-before-free operations from being optimized out
Diffstat (limited to 'src/fastd.h')
-rw-r--r-- | src/fastd.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/fastd.h b/src/fastd.h index 723b1e7..efd785a 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -497,4 +497,9 @@ static inline size_t min_size_t(size_t a, size_t b) { return (a < b) ? a : b; } +static inline void secure_memzero(void *s, size_t n) { + memset(s, 0, n); + asm volatile("" : : "m"(s)); +} + #endif /* _FASTD_FASTD_H_ */ |