From 520995018787d2b65446de440635ac38ee4bac04 Mon Sep 17 00:00:00 2001 From: asmodai Date: Tue, 1 Aug 2000 08:07:15 +0000 Subject: [PATCH] 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 on -current. --- crypto/openssh/authfd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crypto/openssh/authfd.c b/crypto/openssh/authfd.c index d770bfe8c54a..6b4952e41c2d 100644 --- a/crypto/openssh/authfd.c +++ b/crypto/openssh/authfd.c @@ -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; }