Chalk up another phkmalloc victim.

It seems as if uninitialised memory was the culprit.

We may want to contribute this back to the OpenSSH project.

Submitted by:	Alexander Leidinger <Alexander@Leidinger.net> on -current.
This commit is contained in:
Jeroen Ruigrok van der Werven 2000-08-01 08:07:15 +00:00
parent c7d5594134
commit f30cce5c6c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64098

View File

@ -33,7 +33,7 @@ int
ssh_get_authentication_socket()
{
const char *authsocket;
int sock;
int sock, len;
struct sockaddr_un sunaddr;
authsocket = getenv(SSH_AUTHSOCKET_ENV_NAME);
@ -42,6 +42,7 @@ ssh_get_authentication_socket()
sunaddr.sun_family = AF_UNIX;
strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path));
sunaddr.sun_len = len = SUN_LEN(&sunaddr)+1;
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
@ -52,7 +53,7 @@ ssh_get_authentication_socket()
close(sock);
return -1;
}
if (connect(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) {
if (connect(sock, (struct sockaddr *) & sunaddr, len) < 0) {
close(sock);
return -1;
}