summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authordjm <djm>2002-06-26 09:14:25 +0000
committerdjm <djm>2002-06-26 09:14:25 +0000
commit633c1b061528ef70fa89b9ec6e7252d5a71532fe (patch)
tree3eb12486d73c3f1ba2b5c0d126c31a182deab2e8 /buffer.c
parentf6d30ce20d31a9a861c8c1a1f419b21b03e51d2a (diff)
downloadopenssh-633c1b061528ef70fa89b9ec6e7252d5a71532fe.tar.gz
- markus@cvs.openbsd.org 2002/06/26 08:54:18
[buffer.c] limit append to 1MB and buffers to 10MB
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index 40572e5a..ad04b267 100644
--- a/buffer.c
+++ b/buffer.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: buffer.c,v 1.15 2002/01/18 18:14:17 stevesk Exp $");
+RCSID("$OpenBSD: buffer.c,v 1.16 2002/06/26 08:54:18 markus Exp $");
#include "xmalloc.h"
#include "buffer.h"
@@ -71,6 +71,9 @@ buffer_append_space(Buffer *buffer, u_int len)
{
void *p;
+ if (len > 0x100000)
+ fatal("buffer_append_space: len %u not supported", len);
+
/* If the buffer is empty, start using it from the beginning. */
if (buffer->offset == buffer->end) {
buffer->offset = 0;
@@ -96,6 +99,9 @@ restart:
}
/* Increase the size of the buffer and retry. */
buffer->alloc += len + 32768;
+ if (buffer->alloc > 0xa00000)
+ fatal("buffer_append_space: alloc %u not supported",
+ buffer->alloc);
buffer->buf = xrealloc(buffer->buf, buffer->alloc);
goto restart;
/* NOTREACHED */