To: vim-dev@vim.org Subject: patch 5.4.24 Fcc: outbox From: Bram Moolenaar ------------ This is an important one. Brad lost a file because of this bug. Patch 5.4.24 Problem: Encryption: When using ":r file" while 'key' has already entered, the 'key' option would be messed up. When writing the file it would be encrypted with an unknown key and lost! (Brad Despres) Solution: Don't free cryptkey when it is equal to the 'key' option. Files: src/fileio.c *** ../vim-5.4.23/src/fileio.c Tue Aug 10 16:09:10 1999 --- src/fileio.c Thu Aug 12 22:16:54 1999 *************** *** 533,543 **** cryptkey = curbuf->b_p_key; else { cryptkey = get_crypt_key(newfile); /* check if empty key entered */ if (cryptkey != NULL && *cryptkey == NUL) { ! if (!newfile) vim_free(cryptkey); cryptkey = NULL; } --- 533,545 ---- cryptkey = curbuf->b_p_key; else { + /* When newfile is TRUE, store the typed key in + * the 'key' option and don't free it. */ cryptkey = get_crypt_key(newfile); /* check if empty key entered */ if (cryptkey != NULL && *cryptkey == NUL) { ! if (cryptkey != curbuf->b_p_key) vim_free(cryptkey); cryptkey = NULL; } *************** *** 793,799 **** if (newfile) curbuf->b_start_ffc = *curbuf->b_p_ff; /* remember 'fileformat' */ #ifdef CRYPTV ! else vim_free(cryptkey); #endif --- 795,801 ---- if (newfile) curbuf->b_start_ffc = *curbuf->b_p_ff; /* remember 'fileformat' */ #ifdef CRYPTV ! if (cryptkey != curbuf->b_p_key) vim_free(cryptkey); #endif *** ../vim-5.4.23/src/version.h Wed Aug 11 23:19:48 1999 --- src/version.h Thu Aug 12 22:21:37 1999 *************** *** 19,26 **** #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 23 ! #define VIM_VERSION_PATCHLEVEL_STR "23" /* * VIM_VERSION_NODOT is used for the runtime directory name. --- 19,26 ---- #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 24 ! #define VIM_VERSION_PATCHLEVEL_STR "24" /* * VIM_VERSION_NODOT is used for the runtime directory name. *************** *** 30,35 **** */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.23" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.23 (1999 Aug 11)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.23 (1999 Aug 11, compiled " --- 30,35 ---- */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.24" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.24 (1999 Aug 12)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.24 (1999 Aug 12, compiled " -- hundred-and-one symptoms of being an internet addict: 67. Your hard drive crashes. You haven't logged in for two hours. You start to twitch. You pick up the phone and manually dial your ISP's access number. You try to hum to communicate with the modem. You succeed. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /