Sodium::SecureBuffer Fix copying noaccess SecureBuffer's.

This commit is contained in:
Didactic Drunk 2019-09-28 08:58:25 -07:00
parent 1e240f70b6
commit f766db7e9e

View File

@ -49,7 +49,10 @@ module Sodium
# For .dup # For .dup
def initialize(sbuf : self) def initialize(sbuf : self)
initialize sbuf.bytesize initialize sbuf.bytesize
# Maybe not thread safe
sbuf.readonly do
sbuf.to_slice.copy_to self.to_slice sbuf.to_slice.copy_to self.to_slice
end
readonly readonly
end end