Blame SOURCES/7.4.010

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.010
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.010 (after 7.4.006)
22c937
Problem:    Crash with invalid argument to mkdir().
22c937
Solution:   Check for empty string. (lcd47)
22c937
Files:	    src/eval.c
22c937
22c937
22c937
*** ../vim-7.4.009/src/eval.c	2013-08-22 12:06:50.000000000 +0200
22c937
--- src/eval.c	2013-08-30 15:47:47.000000000 +0200
22c937
***************
22c937
*** 14292,14309 ****
22c937
  	return;
22c937
  
22c937
      dir = get_tv_string_buf(&argvars[0], buf);
22c937
!     if (*gettail(dir) == NUL)
22c937
! 	/* remove trailing slashes */
22c937
! 	*gettail_sep(dir) = NUL;
22c937
! 
22c937
!     if (argvars[1].v_type != VAR_UNKNOWN)
22c937
      {
22c937
! 	if (argvars[2].v_type != VAR_UNKNOWN)
22c937
! 	    prot = get_tv_number_chk(&argvars[2], NULL);
22c937
! 	if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
22c937
! 	    mkdir_recurse(dir, prot);
22c937
      }
22c937
-     rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
22c937
  }
22c937
  #endif
22c937
  
22c937
--- 14292,14314 ----
22c937
  	return;
22c937
  
22c937
      dir = get_tv_string_buf(&argvars[0], buf);
22c937
!     if (*dir == NUL)
22c937
! 	rettv->vval.v_number = FAIL;
22c937
!     else
22c937
      {
22c937
! 	if (*gettail(dir) == NUL)
22c937
! 	    /* remove trailing slashes */
22c937
! 	    *gettail_sep(dir) = NUL;
22c937
! 
22c937
! 	if (argvars[1].v_type != VAR_UNKNOWN)
22c937
! 	{
22c937
! 	    if (argvars[2].v_type != VAR_UNKNOWN)
22c937
! 		prot = get_tv_number_chk(&argvars[2], NULL);
22c937
! 	    if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
22c937
! 		mkdir_recurse(dir, prot);
22c937
! 	}
22c937
! 	rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
22c937
      }
22c937
  }
22c937
  #endif
22c937
  
22c937
*** ../vim-7.4.009/src/version.c	2013-08-25 17:46:05.000000000 +0200
22c937
--- src/version.c	2013-08-30 15:48:37.000000000 +0200
22c937
***************
22c937
*** 729,730 ****
22c937
--- 729,732 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     10,
22c937
  /**/
22c937
22c937
-- 
22c937
I wish there was a knob on the TV to turn up the intelligence.
22c937
There's a knob called "brightness", but it doesn't seem to work. 
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///