diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-29 20:37:49 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-29 20:37:49 +0200 |
commit | 131530a54d0f72b820b027606231744e3a09b9ef (patch) | |
tree | d288b74f18adb46ab6917e506dc78616fd0463c7 /src/buffer.c | |
parent | 41114a2a27047bf1884e092b98c6298c128eb2f0 (diff) | |
download | vim-git-131530a54d0f72b820b027606231744e3a09b9ef.tar.gz |
patch 8.2.3245: the crypt key may appear in a swap partitionv8.2.3245
Problem: The crypt key may appear in a swap partition.
Solution: When using xchaha20 use sodium_mlock(). (Christian Brabandt,
closes #8657)
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 59397e4a5..628c82f18 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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); |