aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorJeroen Ruigrok van der Werven <asmodai@FreeBSD.org>2000-08-01 08:07:15 +0000
committerJeroen Ruigrok van der Werven <asmodai@FreeBSD.org>2000-08-01 08:07:15 +0000
commitf30cce5c6cad7cb3f19eef1e4ec09c0b2684b4d0 (patch)
tree25f669d93c42b18a91ca1beb7871e49d93a4da6d /crypto
parentc7d559413426070050bae9fd54b224dafd7600a4 (diff)
downloadsrc-f30cce5c6cad7cb3f19eef1e4ec09c0b2684b4d0.tar.gz
src-f30cce5c6cad7cb3f19eef1e4ec09c0b2684b4d0.zip
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.
Notes
Notes: svn path=/head/; revision=64098
Diffstat (limited to 'crypto')
-rw-r--r--crypto/openssh/authfd.c5
1 files 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;
}