1 /* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */ 2 3 #include "lib.h" 4 #include "safe-memset.h" 5 safe_memset(void * data,int c,size_t size)6void safe_memset(void *data, int c, size_t size) 7 { 8 volatile unsigned int volatile_zero_idx = 0; 9 volatile unsigned char *p = data; 10 11 if (size == 0) 12 return; 13 14 do { 15 memset(data, c, size); 16 } while (p[volatile_zero_idx] != c); 17 } 18