Karsten Hopp 33aa0d
To: vim_dev@googlegroups.com
Karsten Hopp 33aa0d
Subject: Patch 7.3.156
Karsten Hopp 33aa0d
Fcc: outbox
Karsten Hopp 33aa0d
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 33aa0d
Mime-Version: 1.0
Karsten Hopp 33aa0d
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 33aa0d
Content-Transfer-Encoding: 8bit
Karsten Hopp 33aa0d
------------
Karsten Hopp 33aa0d
Karsten Hopp 33aa0d
Patch 7.3.156
Karsten Hopp 33aa0d
Problem:    Tty names possibly left unterminated.
Karsten Hopp 33aa0d
Solution:   Use vim_strncpy() instead of strncpy().
Karsten Hopp 33aa0d
Files:	    src/pty.c
Karsten Hopp 33aa0d
Karsten Hopp 33aa0d
Karsten Hopp 33aa0d
*** ../vim-7.3.155/src/pty.c	2010-08-15 21:57:28.000000000 +0200
Karsten Hopp 33aa0d
--- src/pty.c	2011-04-11 14:02:49.000000000 +0200
Karsten Hopp 33aa0d
***************
Karsten Hopp 33aa0d
*** 209,216 ****
Karsten Hopp 33aa0d
  #ifdef _SEQUENT_
Karsten Hopp 33aa0d
      fvhangup(s);
Karsten Hopp 33aa0d
  #endif
Karsten Hopp 33aa0d
!     strncpy(PtyName, m, sizeof(PtyName));
Karsten Hopp 33aa0d
!     strncpy(TtyName, s, sizeof(TtyName));
Karsten Hopp 33aa0d
      initmaster(f);
Karsten Hopp 33aa0d
      *ttyn = TtyName;
Karsten Hopp 33aa0d
      return f;
Karsten Hopp 33aa0d
--- 209,216 ----
Karsten Hopp 33aa0d
  #ifdef _SEQUENT_
Karsten Hopp 33aa0d
      fvhangup(s);
Karsten Hopp 33aa0d
  #endif
Karsten Hopp 33aa0d
!     vim_strncpy((char_u *)PtyName, (char_u *)m, sizeof(PtyName) - 1);
Karsten Hopp 33aa0d
!     vim_strncpy((char_u *)TtyName, (char_u *)s, sizeof(TtyName) - 1);
Karsten Hopp 33aa0d
      initmaster(f);
Karsten Hopp 33aa0d
      *ttyn = TtyName;
Karsten Hopp 33aa0d
      return f;
Karsten Hopp 33aa0d
***************
Karsten Hopp 33aa0d
*** 301,307 ****
Karsten Hopp 33aa0d
  	return -1;
Karsten Hopp 33aa0d
      }
Karsten Hopp 33aa0d
      signal(SIGCHLD, sigcld);
Karsten Hopp 33aa0d
!     strncpy(TtyName, m, sizeof(TtyName));
Karsten Hopp 33aa0d
      initmaster(f);
Karsten Hopp 33aa0d
      *ttyn = TtyName;
Karsten Hopp 33aa0d
      return f;
Karsten Hopp 33aa0d
--- 301,307 ----
Karsten Hopp 33aa0d
  	return -1;
Karsten Hopp 33aa0d
      }
Karsten Hopp 33aa0d
      signal(SIGCHLD, sigcld);
Karsten Hopp 33aa0d
!     vim_strncpy((char_u *)TtyName, (char_u *)m, sizeof(TtyName) - 1);
Karsten Hopp 33aa0d
      initmaster(f);
Karsten Hopp 33aa0d
      *ttyn = TtyName;
Karsten Hopp 33aa0d
      return f;
Karsten Hopp 33aa0d
***************
Karsten Hopp 33aa0d
*** 326,332 ****
Karsten Hopp 33aa0d
      /* a dumb looking loop replaced by mycrofts code: */
Karsten Hopp 33aa0d
      if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_EXTRA)) < 0)
Karsten Hopp 33aa0d
  	return -1;
Karsten Hopp 33aa0d
!     strncpy(TtyName, ttyname(f), sizeof(TtyName));
Karsten Hopp 33aa0d
      if (geteuid() != ROOT_UID && mch_access(TtyName, R_OK | W_OK))
Karsten Hopp 33aa0d
      {
Karsten Hopp 33aa0d
  	close(f);
Karsten Hopp 33aa0d
--- 326,332 ----
Karsten Hopp 33aa0d
      /* a dumb looking loop replaced by mycrofts code: */
Karsten Hopp 33aa0d
      if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_EXTRA)) < 0)
Karsten Hopp 33aa0d
  	return -1;
Karsten Hopp 33aa0d
!     vim_strncpy((char_u *)TtyName, (char_u *)ttyname(f), sizeof(TtyName) - 1);
Karsten Hopp 33aa0d
      if (geteuid() != ROOT_UID && mch_access(TtyName, R_OK | W_OK))
Karsten Hopp 33aa0d
      {
Karsten Hopp 33aa0d
  	close(f);
Karsten Hopp 33aa0d
*** ../vim-7.3.155/src/version.c	2011-04-11 13:46:07.000000000 +0200
Karsten Hopp 33aa0d
--- src/version.c	2011-04-11 14:23:38.000000000 +0200
Karsten Hopp 33aa0d
***************
Karsten Hopp 33aa0d
*** 716,717 ****
Karsten Hopp 33aa0d
--- 716,719 ----
Karsten Hopp 33aa0d
  {   /* Add new patch number below this line */
Karsten Hopp 33aa0d
+ /**/
Karsten Hopp 33aa0d
+     156,
Karsten Hopp 33aa0d
  /**/
Karsten Hopp 33aa0d
Karsten Hopp 33aa0d
-- 
Karsten Hopp 33aa0d
I think that you'll agree that engineers are very effective in their social
Karsten Hopp 33aa0d
interactions.  It's the "normal" people who are nuts.
Karsten Hopp 33aa0d
				(Scott Adams - The Dilbert principle)
Karsten Hopp 33aa0d
Karsten Hopp 33aa0d
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 33aa0d
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 33aa0d
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 33aa0d
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///