From 4040fe10a9fb735bf75670522d11408ee654f74d Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Mon, 5 Mar 2001 06:52:57 +0000 Subject: [PATCH] - markus@cvs.openbsd.org 2001/03/01 22:46:37 [ssh.c] don't truncate remote ssh-2 commands; from mkubita@securities.cz use min, not max for logging, fixes overflow. --- ChangeLog | 6 +++++- ssh.c | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2178864f7..2bb15d2ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -106,6 +106,10 @@ - deraadt@cvs.openbsd.org 2001/03/01 03:38:33 [cli.c cli.h rijndael.h ssh-keyscan.1] copyright notices on all source files + - markus@cvs.openbsd.org 2001/03/01 22:46:37 + [ssh.c] + don't truncate remote ssh-2 commands; from mkubita@securities.cz + use min, not max for logging, fixes overflow. 20010304 - (bal) Remove make-ssh-known-hosts.1 since it's no longer valid. @@ -4298,4 +4302,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.884 2001/03/05 06:50:47 mouring Exp $ +$Id: ChangeLog,v 1.885 2001/03/05 06:52:57 mouring Exp $ diff --git a/ssh.c b/ssh.c index cf6b03796..c76c7bb71 100644 --- a/ssh.c +++ b/ssh.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.99 2001/03/01 02:29:04 deraadt Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.100 2001/03/01 22:46:37 markus Exp $"); #include #include @@ -936,7 +936,8 @@ client_subsystem_reply(int type, int plen, void *ctxt) id = packet_get_int(); len = buffer_len(&command); - len = MAX(len, 900); + if (len > 900) + len = 900; packet_done(); if (type == SSH2_MSG_CHANNEL_FAILURE) fatal("Request for subsystem '%.*s' failed on channel %d", @@ -1009,7 +1010,7 @@ ssh_session2_callback(int id, void *arg) debug("Sending command: %.*s", len, buffer_ptr(&command)); channel_request_start(id, "exec", 0); } - packet_put_string(buffer_ptr(&command), len); + packet_put_string(buffer_ptr(&command), buffer_len(&command)); packet_send(); } else { channel_request(id, "shell", 0);