Subject: patch 5.4.2 (was: gvim5.4 Bug?)
From: Bram Moolenaar <[email-masked]>
To: Rajesh Kallingal <[email-masked]>
Cc: "[email-masked]" <[email-masked]>

------------

Rajesh Kallingal wrote:

> I was trying to open an encrypted file. But when prompted for 'Enter
> encryption key:', I pressed <ESC> and gvim crashed. Did anyone encountered
> this before?
> 
> I am using gvim 5.4 release on Windoze NT.

The same problem happens on all systems.  It's a NULL pointer problem.

Patch 5.4.2 
Problem:    Typing <Esc> at the crypt key prompt caused a crash. (Kallingal)
Solution:   Check for a NULL pointer returned from get_crypt_key().
Files:      src/fileio.c

*** ../vim-5.4/src/fileio.c	Sun Jul 25 22:02:07 1999
--- src/fileio.c	Tue Jul 27 20:49:01 1999
***************
*** 534,540 ****
  			else
  			{
  			    cryptkey = get_crypt_key(newfile);
! 			    if (!*cryptkey)	/* no key entered */
  			    {
  				if (!newfile)
  				    vim_free(cryptkey);
--- 534,541 ----
  			else
  			{
  			    cryptkey = get_crypt_key(newfile);
! 			    /* check if empty key entered */
! 			    if (cryptkey != NULL && *cryptkey == NUL)
  			    {
  				if (!newfile)
  				    vim_free(cryptkey);
*** .../vim-5.4/src/version.h	Tue Jul 27 21:00:55 1999
--- src/version.h	Tue Jul 27 21:01:14 1999
***************
*** 19,26 ****
  #define VIM_VERSION_MINOR_STR		"4"
  #define VIM_VERSION_BUILD		 57
  #define VIM_VERSION_BUILD_STR		"57"
! #define VIM_VERSION_PATCHLEVEL		 1
! #define VIM_VERSION_PATCHLEVEL_STR	"1"
  
  /*
   * 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		 2
! #define VIM_VERSION_PATCHLEVEL_STR	"2"
  
  /*
   * 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.1"
! #define VIM_VERSION_LONG	"VIM - Vi IMproved 5.4.1 (1999 Jul 27)"
! #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 5.4.1 (1999 Jul 27, compiled "
--- 30,35 ----
   */
  #define VIM_VERSION_NODOT	"vim54"
  #define VIM_VERSION_SHORT	"5.4"
! #define VIM_VERSION_MEDIUM	"5.4.2"
! #define VIM_VERSION_LONG	"VIM - Vi IMproved 5.4.2 (1999 Jul 27)"
! #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 5.4.2 (1999 Jul 27, compiled "

--
       When danger reared its ugly head,
       He bravely turned his tail and fled
       Yes, Brave Sir Robin turned about
       And gallantly he chickened out
       Bravely taking to his feet
       He beat a very brave retreat
       Bravest of the brave Sir Robin
       Petrified of being dead
       Soiled his pants then brave Sir Robin
       Turned away and fled.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

--/-/---- Bram Moolenaar ---- [email-masked] ---- [email-masked] ---\-\--
  \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /