summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--sftp-client.c9
-rw-r--r--sftp-common.h5
-rw-r--r--sftp-server.c4
4 files changed, 13 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index b5a9c9bc5..7e8839305 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,9 @@
20 - stevesk@cvs.openbsd.org 2006/01/01 10:08:48 20 - stevesk@cvs.openbsd.org 2006/01/01 10:08:48
21 [misc.c] 21 [misc.c]
22 no trailing "\n" for debug() 22 no trailing "\n" for debug()
23 - djm@cvs.openbsd.org 2006/01/02 01:20:31
24 [sftp-client.c sftp-common.h sftp-server.c]
25 use a common max. packet length, no binary change
23 26
2420060101 2720060101
25 - (djm) [Makefile.in configure.ac includes.h misc.c] 28 - (djm) [Makefile.in configure.ac includes.h misc.c]
@@ -3610,4 +3613,4 @@
3610 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 3613 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
3611 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 3614 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
3612 3615
3613$Id: ChangeLog,v 1.4068 2006/01/02 12:40:30 djm Exp $ 3616$Id: ChangeLog,v 1.4069 2006/01/02 12:40:50 djm Exp $
diff --git a/sftp-client.c b/sftp-client.c
index afbd1e6f3..05bce3368 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -20,7 +20,7 @@
20/* XXX: copy between two remote sites */ 20/* XXX: copy between two remote sites */
21 21
22#include "includes.h" 22#include "includes.h"
23RCSID("$OpenBSD: sftp-client.c,v 1.57 2005/07/27 10:39:03 dtucker Exp $"); 23RCSID("$OpenBSD: sftp-client.c,v 1.58 2006/01/02 01:20:31 djm Exp $");
24 24
25#include "openbsd-compat/sys-queue.h" 25#include "openbsd-compat/sys-queue.h"
26 26
@@ -42,9 +42,6 @@ extern int showprogress;
42/* Minimum amount of data to read at at time */ 42/* Minimum amount of data to read at at time */
43#define MIN_READ_SIZE 512 43#define MIN_READ_SIZE 512
44 44
45/* Maximum packet size */
46#define MAX_MSG_LENGTH (256 * 1024)
47
48struct sftp_conn { 45struct sftp_conn {
49 int fd_in; 46 int fd_in;
50 int fd_out; 47 int fd_out;
@@ -59,7 +56,7 @@ send_msg(int fd, Buffer *m)
59{ 56{
60 u_char mlen[4]; 57 u_char mlen[4];
61 58
62 if (buffer_len(m) > MAX_MSG_LENGTH) 59 if (buffer_len(m) > SFTP_MAX_MSG_LENGTH)
63 fatal("Outbound message too long %u", buffer_len(m)); 60 fatal("Outbound message too long %u", buffer_len(m));
64 61
65 /* Send length first */ 62 /* Send length first */
@@ -87,7 +84,7 @@ get_msg(int fd, Buffer *m)
87 } 84 }
88 85
89 msg_len = buffer_get_int(m); 86 msg_len = buffer_get_int(m);
90 if (msg_len > MAX_MSG_LENGTH) 87 if (msg_len > SFTP_MAX_MSG_LENGTH)
91 fatal("Received message too long %u", msg_len); 88 fatal("Received message too long %u", msg_len);
92 89
93 buffer_append_space(m, msg_len); 90 buffer_append_space(m, msg_len);
diff --git a/sftp-common.h b/sftp-common.h
index b42ba9140..2b1995a2d 100644
--- a/sftp-common.h
+++ b/sftp-common.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-common.h,v 1.5 2003/11/10 16:23:41 jakob Exp $ */ 1/* $OpenBSD: sftp-common.h,v 1.6 2006/01/02 01:20:31 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -25,6 +25,9 @@
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/* Maximum packet that we are willing to send/accept */
29#define SFTP_MAX_MSG_LENGTH (256 * 1024)
30
28typedef struct Attrib Attrib; 31typedef struct Attrib Attrib;
29 32
30/* File attributes */ 33/* File attributes */
diff --git a/sftp-server.c b/sftp-server.c
index 4fa07e2f5..7060c44ad 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: sftp-server.c,v 1.49 2005/09/13 23:40:07 djm Exp $"); 17RCSID("$OpenBSD: sftp-server.c,v 1.50 2006/01/02 01:20:31 djm Exp $");
18 18
19#include "buffer.h" 19#include "buffer.h"
20#include "bufaux.h" 20#include "bufaux.h"
@@ -946,7 +946,7 @@ process(void)
946 return; /* Incomplete message. */ 946 return; /* Incomplete message. */
947 cp = buffer_ptr(&iqueue); 947 cp = buffer_ptr(&iqueue);
948 msg_len = GET_32BIT(cp); 948 msg_len = GET_32BIT(cp);
949 if (msg_len > 256 * 1024) { 949 if (msg_len > SFTP_MAX_MSG_LENGTH) {
950 error("bad message "); 950 error("bad message ");
951 exit(11); 951 exit(11);
952 } 952 }