From 2686bb52504f7e1319a09ba6e5d0688fab7aac0c Mon Sep 17 00:00:00 2001 From: Markus Friedl Date: Wed, 26 Jun 2002 08:54:19 +0000 Subject: limit append to 1MB and buffers to 10MB --- usr.bin/ssh/buffer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'usr.bin') diff --git a/usr.bin/ssh/buffer.c b/usr.bin/ssh/buffer.c index 40572e5ac30..ad04b267e0d 100644 --- a/usr.bin/ssh/buffer.c +++ b/usr.bin/ssh/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 */ -- cgit v1.2.3