diff src/optionstr.c @ 32677:4091ae33b9ec v9.0.1669

patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt Commit: https://github.com/vim/vim/commit/19e6c4fd2d262075d39cb802ea5b85f5ec92f153 Author: Christian Brabandt <cb@256bit.org> Date: Tue Jun 27 18:57:10 2023 +0100 patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt 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)
author Bram Moolenaar <Bram@vim.org>
date Tue, 27 Jun 2023 20:00:04 +0200
parents 695b50472e85
children 161ae1985d81
line wrap: on
line diff
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -1174,6 +1174,10 @@ did_set_cryptkey(optset_T *args)
 		*curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
 	changed_internal();
     }
+# ifdef FEAT_SODIUM
+    if (crypt_method_is_sodium(crypt_get_method_nr(curbuf)))
+       crypt_sodium_lock_key(args->os_newval.string);
+# endif
 
     return NULL;
 }