summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2005-03-14 23:22:25 +1100
committerDarren Tucker <dtucker@zip.com.au>2005-03-14 23:22:25 +1100
commit11327cc5d7437b17f98580f1f173918873872c0d (patch)
tree791c8e0394d790059863e63bd8c4d35d9f593fe1 /buffer.c
parenta8f553df53bf116c16de409a0d6bc897d0a2f228 (diff)
downloadopenssh-git-11327cc5d7437b17f98580f1f173918873872c0d.tar.gz
- markus@cvs.openbsd.org 2005/03/14 11:46:56
[buffer.c buffer.h channels.c] limit input buffer size for channels; bugzilla #896; with and ok dtucker@
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/buffer.c b/buffer.c
index 1a25004b..487e0810 100644
--- a/buffer.c
+++ b/buffer.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: buffer.c,v 1.22 2004/10/29 23:56:17 djm Exp $");
+RCSID("$OpenBSD: buffer.c,v 1.23 2005/03/14 11:46:56 markus Exp $");
#include "xmalloc.h"
#include "buffer.h"
@@ -78,7 +78,7 @@ buffer_append_space(Buffer *buffer, u_int len)
u_int newlen;
void *p;
- if (len > 0x100000)
+ if (len > BUFFER_MAX_CHUNK)
fatal("buffer_append_space: len %u not supported", len);
/* If the buffer is empty, start using it from the beginning. */
@@ -97,7 +97,7 @@ restart:
* If the buffer is quite empty, but all data is at the end, move the
* data to the beginning and retry.
*/
- if (buffer->offset > buffer->alloc / 2) {
+ if (buffer->offset > MIN(buffer->alloc, BUFFER_MAX_CHUNK)) {
memmove(buffer->buf, buffer->buf + buffer->offset,
buffer->end - buffer->offset);
buffer->end -= buffer->offset;
@@ -107,7 +107,7 @@ restart:
/* Increase the size of the buffer and retry. */
newlen = buffer->alloc + len + 32768;
- if (newlen > 0xa00000)
+ if (newlen > BUFFER_MAX_LEN)
fatal("buffer_append_space: alloc %u not supported",
newlen);
buffer->buf = xrealloc(buffer->buf, newlen);