summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-20 06:52:03 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-20 06:52:03 +0200
commitf6640a80f4be19e988fd7426c3f897f4d3f614e4 (patch)
tree3b6764fc547ee9ea1559ed1fb2c9b4fd4eb0726a /src/fastd.h
parentd9dc87d8409ddf8361b7fcb311ae97088ed1d984 (diff)
downloadfastd-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.h5
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_ */