diff options
author | Christian Brabandt <cb@256bit.org> | 2023-06-27 18:57:10 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-06-27 18:57:10 +0100 |
commit | 19e6c4fd2d262075d39cb802ea5b85f5ec92f153 (patch) | |
tree | a550dc395cbf1f136c384e0fddfe12dbcd4831e3 /src/crypt.c | |
parent | 0256d76a3392aef270b38d1cf7633008e45c2003 (diff) |
patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium cryptv9.0.1669
Problem: Crash syncing swapfile in new buffer when using sodium crypt.
(James McCoy)
Solution: Add checks for sodium encryption. (Christian Brabandt,
closes #12591, closes #12585)
Diffstat (limited to 'src/crypt.c')
-rw-r--r-- | src/crypt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/crypt.c b/src/crypt.c index daa608ae68..9f0f68a2d4 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -1267,6 +1267,13 @@ crypt_sodium_buffer_decode( } # if defined(FEAT_SODIUM) || defined(PROTO) + void +crypt_sodium_lock_key(char_u *key) +{ + if (sodium_init() >= 0) + sodium_mlock(key, STRLEN(key)); +} + int crypt_sodium_munlock(void *const addr, const size_t len) { |