diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2006-01-02 01:20:32 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2006-01-02 01:20:32 +0000 |
commit | 650d8360f968a821468bb81158dd1744b0318479 (patch) | |
tree | 3e0cfc9f9fe00885f4158971d6d22eff433b7eef /usr.bin | |
parent | 13785fe278e6bcfd426efe41f57432eb2c1f3173 (diff) |
use a common max. packet length, no binary change
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/sftp-client.c | 9 | ||||
-rw-r--r-- | usr.bin/ssh/sftp-common.h | 5 | ||||
-rw-r--r-- | usr.bin/ssh/sftp-server.c | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c index 8ac93f34343..c83b09ef2fd 100644 --- a/usr.bin/ssh/sftp-client.c +++ b/usr.bin/ssh/sftp-client.c @@ -20,7 +20,7 @@ /* XXX: copy between two remote sites */ #include "includes.h" -RCSID("$OpenBSD: sftp-client.c,v 1.57 2005/07/27 10:39:03 dtucker Exp $"); +RCSID("$OpenBSD: sftp-client.c,v 1.58 2006/01/02 01:20:31 djm Exp $"); #include <sys/queue.h> @@ -42,9 +42,6 @@ extern int showprogress; /* Minimum amount of data to read at at time */ #define MIN_READ_SIZE 512 -/* Maximum packet size */ -#define MAX_MSG_LENGTH (256 * 1024) - struct sftp_conn { int fd_in; int fd_out; @@ -59,7 +56,7 @@ send_msg(int fd, Buffer *m) { u_char mlen[4]; - if (buffer_len(m) > MAX_MSG_LENGTH) + if (buffer_len(m) > SFTP_MAX_MSG_LENGTH) fatal("Outbound message too long %u", buffer_len(m)); /* Send length first */ @@ -87,7 +84,7 @@ get_msg(int fd, Buffer *m) } msg_len = buffer_get_int(m); - if (msg_len > MAX_MSG_LENGTH) + if (msg_len > SFTP_MAX_MSG_LENGTH) fatal("Received message too long %u", msg_len); buffer_append_space(m, msg_len); diff --git a/usr.bin/ssh/sftp-common.h b/usr.bin/ssh/sftp-common.h index b42ba91409f..2b1995a2de7 100644 --- a/usr.bin/ssh/sftp-common.h +++ b/usr.bin/ssh/sftp-common.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp-common.h,v 1.5 2003/11/10 16:23:41 jakob Exp $ */ +/* $OpenBSD: sftp-common.h,v 1.6 2006/01/02 01:20:31 djm Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -25,6 +25,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* Maximum packet that we are willing to send/accept */ +#define SFTP_MAX_MSG_LENGTH (256 * 1024) + typedef struct Attrib Attrib; /* File attributes */ diff --git a/usr.bin/ssh/sftp-server.c b/usr.bin/ssh/sftp-server.c index 8e78377f0b4..58b50af9ca5 100644 --- a/usr.bin/ssh/sftp-server.c +++ b/usr.bin/ssh/sftp-server.c @@ -14,7 +14,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "includes.h" -RCSID("$OpenBSD: sftp-server.c,v 1.49 2005/09/13 23:40:07 djm Exp $"); +RCSID("$OpenBSD: sftp-server.c,v 1.50 2006/01/02 01:20:31 djm Exp $"); #include "buffer.h" #include "bufaux.h" @@ -926,7 +926,7 @@ process(void) return; /* Incomplete message. */ cp = buffer_ptr(&iqueue); msg_len = GET_32BIT(cp); - if (msg_len > 256 * 1024) { + if (msg_len > SFTP_MAX_MSG_LENGTH) { error("bad message "); exit(11); } |