0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.3245: the crypt key may appear in a swap partition

Problem:    The crypt key may appear in a swap partition.
Solution:   When using xchaha20 use sodium_mlock(). (Christian Brabandt,
            closes #8657)
This commit is contained in:
Bram Moolenaar
2021-07-29 20:37:49 +02:00
parent 41114a2a27
commit 131530a54d
7 changed files with 25 additions and 13 deletions

View File

@@ -2306,6 +2306,10 @@ free_buf_options(
clear_string_option(&buf->b_p_fex);
#endif
#ifdef FEAT_CRYPT
# ifdef FEAT_SODIUM
if (buf->b_p_key != NULL && (crypt_get_method_nr(buf) == CRYPT_M_SOD))
sodium_munlock(buf->b_p_key, STRLEN(buf->b_p_key));
# endif
clear_string_option(&buf->b_p_key);
#endif
clear_string_option(&buf->b_p_kp);