summaryrefslogtreecommitdiff
path: root/src/pty.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-04-11 14:24:37 +0200
committerBram Moolenaar <Bram@vim.org>2011-04-11 14:24:37 +0200
commit639304ddb1bcc70b67b3eaf50cefb30415526aa8 (patch)
tree7ea36e4d4637d9ef6cebce5d2b96e3e197e61b5c /src/pty.c
parent32f649e1fc7cdefbb406a397432030bfe17f0e07 (diff)
downloadvim-git-639304ddb1bcc70b67b3eaf50cefb30415526aa8.tar.gz
updated for version 7.3.156v7.3.156
Problem: Tty names possibly left unterminated. Solution: Use vim_strncpy() instead of strncpy().
Diffstat (limited to 'src/pty.c')
-rw-r--r--src/pty.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pty.c b/src/pty.c
index 944eccfb9..bc28c0d9a 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -209,8 +209,8 @@ OpenPTY(ttyn)
#ifdef _SEQUENT_
fvhangup(s);
#endif
- strncpy(PtyName, m, sizeof(PtyName));
- strncpy(TtyName, s, sizeof(TtyName));
+ 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,7 +301,7 @@ OpenPTY(ttyn)
return -1;
}
signal(SIGCHLD, sigcld);
- strncpy(TtyName, m, sizeof(TtyName));
+ vim_strncpy((char_u *)TtyName, (char_u *)m, sizeof(TtyName) - 1);
initmaster(f);
*ttyn = TtyName;
return f;
@@ -326,7 +326,7 @@ OpenPTY(ttyn)
/* 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));
+ 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);