diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-09-29 21:14:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-09-29 21:14:17 +0000 |
commit | bd42b4ae82b68c101d7026b390103e5c550cf0f7 (patch) | |
tree | 0668d19f4d9f3b8bdbed84fb6d1b1af73ceb6884 /usr.bin/ssh/ssh-agent.c | |
parent | 3a463f8415ec56ee971fc5118becee2d84a1b915 (diff) |
numerous sprintf, strncpy, strcpy cleanups
Diffstat (limited to 'usr.bin/ssh/ssh-agent.c')
-rw-r--r-- | usr.bin/ssh/ssh-agent.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c index 28713f2ba70..3c949eeb127 100644 --- a/usr.bin/ssh/ssh-agent.c +++ b/usr.bin/ssh/ssh-agent.c @@ -14,7 +14,7 @@ The authentication agent program. */ #include "includes.h" -RCSID("$Id: ssh-agent.c,v 1.3 1999/09/29 06:15:00 deraadt Exp $"); +RCSID("$Id: ssh-agent.c,v 1.4 1999/09/29 21:14:16 deraadt Exp $"); #include "ssh.h" #include "rsa.h" @@ -563,13 +563,13 @@ main(int ac, char **av) parent_pid = getpid(); - sprintf(socket_name, SSH_AGENT_SOCKET, parent_pid); + snprintf(socket_name, sizeof socket_name, SSH_AGENT_SOCKET, parent_pid); /* Fork, and have the parent execute the command. The child continues as the authentication agent. */ if (fork() != 0) { /* Parent - execute the given command. */ - sprintf(buf, "SSH_AUTHENTICATION_SOCKET=%s", socket_name); + snprintf(buf, sizeof buf, "SSH_AUTHENTICATION_SOCKET=%s", socket_name); putenv(buf); execvp(av[1], av + 1); perror(av[1]); @@ -584,7 +584,7 @@ main(int ac, char **av) } memset(&sunaddr, 0, sizeof(sunaddr)); sunaddr.sun_family = AF_UNIX; - strncpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path)); + strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path)); if (bind(sock, (struct sockaddr *)&sunaddr, AF_UNIX_SIZE(sunaddr)) < 0) { perror("bind"); @@ -643,7 +643,7 @@ main(int ac, char **av) if (fork() != 0) { /* Parent - execute the given command. */ close(sockets[0]); - sprintf(buf, "SSH_AUTHENTICATION_FD=%d", sockets[1]); + snprintf(buf, sizeof buf, "SSH_AUTHENTICATION_FD=%d", sockets[1]); putenv(buf); execvp(av[1], av + 1); perror(av[1]); |