libopenkey icon indicating copy to clipboard operation
libopenkey copied to clipboard

Memsets might be optimized away

Open EricSesterhennX41 opened this issue 5 years ago • 0 comments

In https://github.com/henryk/libopenkey/blob/master/libopenkey/libopenkey.c, line 1715:

if(buf != NULL) {
	memset(buf, 0, buf_length);
	free(buf);
}

The memset() might be optimized away by the compiler, see eg https://media.ccc.de/v/35c3-9788-memsad Similar in line 1808 and 482. I guess the one in line 2092, 2129 might also be optimized away. If there is a gcry_free() instead of free() the compiler doesnt optimize this away in my tests.

EricSesterhennX41 avatar May 28 '19 12:05 EricSesterhennX41