Branch: Tag:

2014-12-04

2014-12-04 19:23:16 by Arne Goedeke <el@laramies.com>

pike_memory: add guaranteed_memset()

Most compilers (gcc in recent versions) optimize away memset before
free. This can prevent sensitive data from being wiped.

131:    struct link *set[MEMSEARCH_LINKS];   };    + /* +  * The purpose of this function is to avoid dead store elimination in cases when +  * sensitive data has to be cleared from memory. +  */ + static INLINE void * guaranteed_memset(void * p, int c, size_t n) { +  volatile char * _p = p; +  while (n--) *_p++ = c; +  return p; + }      #include "pike_search.h"