From f766db7e9e711c5f56fddcd16069e1133773fada Mon Sep 17 00:00:00 2001 From: Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com> Date: Sat, 28 Sep 2019 08:58:25 -0700 Subject: [PATCH] Sodium::SecureBuffer Fix copying noaccess SecureBuffer's. --- src/sodium/secure_buffer.cr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sodium/secure_buffer.cr b/src/sodium/secure_buffer.cr index 05713a3..a7d4248 100644 --- a/src/sodium/secure_buffer.cr +++ b/src/sodium/secure_buffer.cr @@ -49,7 +49,10 @@ module Sodium # For .dup def initialize(sbuf : self) initialize sbuf.bytesize - sbuf.to_slice.copy_to self.to_slice + # Maybe not thread safe + sbuf.readonly do + sbuf.to_slice.copy_to self.to_slice + end readonly end