diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-03-13 15:37:51 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-03-13 15:37:51 +0100 |
commit | 8455d79bb670159b87e2f23a3152fa27951648b7 (patch) | |
tree | fb949e51823ed8d8f349ae4f375f018236c8d4e7 | |
parent | 222a0d78ca5c272ea109e847d62cf12674dd875f (diff) | |
download | libssh-8455d79bb670159b87e2f23a3152fa27951648b7.tar.gz libssh-8455d79bb670159b87e2f23a3152fa27951648b7.tar.xz libssh-8455d79bb670159b87e2f23a3152fa27951648b7.zip |
priv: Make really sure memset doesn't get optimzed out.
-rw-r--r-- | include/libssh/priv.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 24c1221f..912a1918 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -219,10 +219,10 @@ int match_hostname(const char *host, const char *pattern, unsigned int len); #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) /** Overwrite a string with '\0' */ -#define BURN_STRING(x) do { if ((x) != NULL) memset((x), '\0', strlen((x))); __asm__ volatile (""); } while(0) +#define BURN_STRING(x) do { if ((x) != NULL) memset((x), '\0', strlen((x))); __asm__ volatile ("" : : : "memory"); } while(0) /** Overwrite the buffer with '\0' */ -#define BURN_BUFFER(x, size) do { if ((x) != NULL) memset((x), '\0', (size))); __asm__ volatile (""); } while(0) +#define BURN_BUFFER(x, size) do { if ((x) != NULL) memset((x), '\0', (size))); __asm__ volatile ("") : : : "memory"; } while(0) /** * This is a hack to fix warnings. The idea is to use this everywhere that we |