From 8455d79bb670159b87e2f23a3152fa27951648b7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 13 Mar 2013 15:37:51 +0100 Subject: priv: Make really sure memset doesn't get optimzed out. --- include/libssh/priv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 24c1221..912a191 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 -- cgit