diff --git a/ChangeLog b/ChangeLog index f589a537f..d79457079 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ - stevesk@cvs.openbsd.org 2001/12/06 18:02:32 [channels.c sshconnect.c] shutdown(sock, SHUT_RDWR) not needed here; ok markus@ + - stevesk@cvs.openbsd.org 2001/12/06 18:09:23 + [channels.c session.c] + strncpy->strlcpy. remaining strncpy's are necessary. ok markus@ 20011206 - (bal) OpenBSD CVS Sync @@ -7002,4 +7005,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1689 2001/12/07 17:24:49 mouring Exp $ +$Id: ChangeLog,v 1.1690 2001/12/07 17:26:48 mouring Exp $ diff --git a/channels.c b/channels.c index 7cc0d281e..3fe619f48 100644 --- a/channels.c +++ b/channels.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: channels.c,v 1.144 2001/12/06 18:02:32 stevesk Exp $"); +RCSID("$OpenBSD: channels.c,v 1.145 2001/12/06 18:09:23 stevesk Exp $"); #include "ssh.h" #include "ssh1.h" @@ -2609,8 +2609,7 @@ x11_connect_display(void) * Connect to an inet socket. The DISPLAY value is supposedly * hostname:d[.s], where hostname may also be numeric IP address. */ - strncpy(buf, display, sizeof(buf)); - buf[sizeof(buf) - 1] = 0; + strlcpy(buf, display, sizeof(buf)); cp = strchr(buf, ':'); if (!cp) { error("Could not find ':' in DISPLAY: %.100s", display); @@ -2893,8 +2892,7 @@ auth_input_request_forwarding(struct passwd * pw) /* Bind it to the name. */ memset(&sunaddr, 0, sizeof(sunaddr)); sunaddr.sun_family = AF_UNIX; - strncpy(sunaddr.sun_path, auth_sock_name, - sizeof(sunaddr.sun_path)); + strlcpy(sunaddr.sun_path, auth_sock_name, sizeof(sunaddr.sun_path)); if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) packet_disconnect("bind: %.100s", strerror(errno)); diff --git a/session.c b/session.c index 551eb37e6..1d7291e6f 100644 --- a/session.c +++ b/session.c @@ -33,7 +33,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: session.c,v 1.110 2001/12/01 21:41:48 markus Exp $"); +RCSID("$OpenBSD: session.c,v 1.111 2001/12/06 18:09:23 stevesk Exp $"); #include "ssh.h" #include "ssh1.h" @@ -1473,8 +1473,7 @@ do_child(Session *s, const char *command) /* Start the shell. Set initial character to '-'. */ buf[0] = '-'; - strncpy(buf + 1, cp, sizeof(buf) - 1); - buf[sizeof(buf) - 1] = 0; + strlcpy(buf + 1, cp, sizeof(buf) - 1); /* Execute the shell. */ argv[0] = buf;