To: vim_dev@googlegroups.com
Subject: Patch 7.3.156
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.156
Problem:    Tty names possibly left unterminated.
Solution:   Use vim_strncpy() instead of strncpy().
Files:	    src/pty.c


*** ../vim-7.3.155/src/pty.c	2010-08-15 21:57:28.000000000 +0200
--- src/pty.c	2011-04-11 14:02:49.000000000 +0200
***************
*** 209,216 ****
  #ifdef _SEQUENT_
      fvhangup(s);
  #endif
!     strncpy(PtyName, m, sizeof(PtyName));
!     strncpy(TtyName, s, sizeof(TtyName));
      initmaster(f);
      *ttyn = TtyName;
      return f;
--- 209,216 ----
  #ifdef _SEQUENT_
      fvhangup(s);
  #endif
!     vim_strncpy((char_u *)PtyName, (char_u *)m, sizeof(PtyName) - 1);
!     vim_strncpy((char_u *)TtyName, (char_u *)s, sizeof(TtyName) - 1);
      initmaster(f);
      *ttyn = TtyName;
      return f;
***************
*** 301,307 ****
  	return -1;
      }
      signal(SIGCHLD, sigcld);
!     strncpy(TtyName, m, sizeof(TtyName));
      initmaster(f);
      *ttyn = TtyName;
      return f;
--- 301,307 ----
  	return -1;
      }
      signal(SIGCHLD, sigcld);
!     vim_strncpy((char_u *)TtyName, (char_u *)m, sizeof(TtyName) - 1);
      initmaster(f);
      *ttyn = TtyName;
      return f;
***************
*** 326,332 ****
      /* a dumb looking loop replaced by mycrofts code: */
      if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_EXTRA)) < 0)
  	return -1;
!     strncpy(TtyName, ttyname(f), sizeof(TtyName));
      if (geteuid() != ROOT_UID && mch_access(TtyName, R_OK | W_OK))
      {
  	close(f);
--- 326,332 ----
      /* a dumb looking loop replaced by mycrofts code: */
      if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_EXTRA)) < 0)
  	return -1;
!     vim_strncpy((char_u *)TtyName, (char_u *)ttyname(f), sizeof(TtyName) - 1);
      if (geteuid() != ROOT_UID && mch_access(TtyName, R_OK | W_OK))
      {
  	close(f);
*** ../vim-7.3.155/src/version.c	2011-04-11 13:46:07.000000000 +0200
--- src/version.c	2011-04-11 14:23:38.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     156,
  /**/

-- 
I think that you'll agree that engineers are very effective in their social
interactions.  It's the "normal" people who are nuts.
				(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
