From 74860245bcaed8787bfc7d896ab17e603c3cb2a4 Mon Sep 17 00:00:00 2001 From: mouring Date: Fri, 7 Dec 2001 17:26:48 +0000 Subject: [PATCH] - stevesk@cvs.openbsd.org 2001/12/06 18:09:23 [channels.c session.c] strncpy->strlcpy. remaining strncpy's are necessary. ok markus@ --- ChangeLog | 3 +++ channels.c | 8 +++----- session.c | 5 ++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 769d3101..99e02e94 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 diff --git a/channels.c b/channels.c index 7cc0d281..3fe619f4 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 551eb37e..1d7291e6 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; -- 2.45.1