mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
priv: Make really sure memset doesn't get optimzed out.
This commit is contained in:
@@ -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]))
|
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
|
||||||
|
|
||||||
/** Overwrite a string with '\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' */
|
/** 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
|
* This is a hack to fix warnings. The idea is to use this everywhere that we
|
||||||
|
|||||||
Reference in New Issue
Block a user