[sftp-client.c sftp-common.h sftp-server.c]
     use a common max. packet length, no binary change
This commit is contained in:
Damien Miller 2006-01-02 23:40:50 +11:00
Родитель a210d52235
Коммит 5444618987
4 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -20,6 +20,9 @@
- stevesk@cvs.openbsd.org 2006/01/01 10:08:48
[misc.c]
no trailing "\n" for debug()
- djm@cvs.openbsd.org 2006/01/02 01:20:31
[sftp-client.c sftp-common.h sftp-server.c]
use a common max. packet length, no binary change
20060101
- (djm) [Makefile.in configure.ac includes.h misc.c]
@ -3610,4 +3613,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4068 2006/01/02 12:40:30 djm Exp $
$Id: ChangeLog,v 1.4069 2006/01/02 12:40:50 djm Exp $

Просмотреть файл

@ -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 "openbsd-compat/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);

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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"
@ -946,7 +946,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);
}