awnumar / memguard

Secure software enclave for storage of sensitive information in memory.
Apache License 2.0
2.49k stars 124 forks source link

getBytes improperly uses unsafe to convert a Pointer to a slice #137

Closed elagergren-spideroak closed 3 years ago

elagergren-spideroak commented 3 years ago

The only valid way of converting an unsafe.Pointer to a slice is with reflect.SliceHeader.

The struct type used inside getBytes is not guaranteed to work across Go versions.

https://github.com/awnumar/memguard/blob/master/core/auxiliary.go#L18-L26