From 4b10d86ce45d8d0e289df3099f0f0091beb12447 Mon Sep 17 00:00:00 2001 From: Markus Friedl Date: Wed, 24 Nov 1999 20:07:26 +0000 Subject: fix packet_integrity_check() for !have_hostname_in_open. report from mrwizard@psu.edu via djm@ibs.com.au --- usr.bin/ssh/channels.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'usr.bin/ssh') diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c index c0f3854ce80..1db2e920473 100644 --- a/usr.bin/ssh/channels.c +++ b/usr.bin/ssh/channels.c @@ -16,7 +16,7 @@ */ #include "includes.h" -RCSID("$Id: channels.c,v 1.28 1999/11/24 20:02:11 markus Exp $"); +RCSID("$Id: channels.c,v 1.29 1999/11/24 20:07:25 markus Exp $"); #include "ssh.h" #include "packet.h" @@ -1020,13 +1020,16 @@ channel_input_port_open(int payload_len) host_port = packet_get_int(); /* Get remote originator name. */ - if (have_hostname_in_open) + if (have_hostname_in_open) { originator_string = packet_get_string(&originator_len); - else + originator_len += 4; /* size of packet_int */ + } else { originator_string = xstrdup("unknown (remote did not supply name)"); + originator_len = 0; /* no originator supplied */ + } packet_integrity_check(payload_len, - 4 + 4 + host_len + 4 + 4 + originator_len, + 4 + 4 + host_len + 4 + originator_len, SSH_MSG_PORT_OPEN); /* Check if opening that port is permitted. */ @@ -1225,13 +1228,16 @@ x11_input_open(int payload_len) remote_channel = packet_get_int(); /* Get remote originator name. */ - if (have_hostname_in_open) + if (have_hostname_in_open) { remote_host = packet_get_string(&remote_len); - else + remote_len += 4; + } else { remote_host = xstrdup("unknown (remote did not supply name)"); + remote_len = 0; + } debug("Received X11 open request."); - packet_integrity_check(payload_len, 4 + 4 + remote_len, SSH_SMSG_X11_OPEN); + packet_integrity_check(payload_len, 4 + remote_len, SSH_SMSG_X11_OPEN); /* Try to open a socket for the local X server. */ display = getenv("DISPLAY"); -- cgit v1.2.3