[buffer.c]
     limit append to 1MB and buffers to 10MB
This commit is contained in:
Damien Miller 2002-06-26 19:14:25 +10:00
parent aa15137c15
commit 468cd716a5
2 changed files with 11 additions and 2 deletions

View File

@ -39,6 +39,9 @@
- markus@cvs.openbsd.org 2002/06/26 08:53:12 - markus@cvs.openbsd.org 2002/06/26 08:53:12
[bufaux.c] [bufaux.c]
limit size of BNs to 8KB; ok provos/deraadt limit size of BNs to 8KB; ok provos/deraadt
- markus@cvs.openbsd.org 2002/06/26 08:54:18
[buffer.c]
limit append to 1MB and buffers to 10MB
20020625 20020625
- (stevesk) [INSTALL acconfig.h configure.ac defines.h] remove --with-rsh - (stevesk) [INSTALL acconfig.h configure.ac defines.h] remove --with-rsh
@ -1138,4 +1141,4 @@
- (stevesk) entropy.c: typo in debug message - (stevesk) entropy.c: typo in debug message
- (djm) ssh-keygen -i needs seeded RNG; report from markus@ - (djm) ssh-keygen -i needs seeded RNG; report from markus@
$Id: ChangeLog,v 1.2290 2002/06/26 09:14:08 djm Exp $ $Id: ChangeLog,v 1.2291 2002/06/26 09:14:25 djm Exp $

View File

@ -12,7 +12,7 @@
*/ */
#include "includes.h" #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 "xmalloc.h"
#include "buffer.h" #include "buffer.h"
@ -71,6 +71,9 @@ buffer_append_space(Buffer *buffer, u_int len)
{ {
void *p; 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 the buffer is empty, start using it from the beginning. */
if (buffer->offset == buffer->end) { if (buffer->offset == buffer->end) {
buffer->offset = 0; buffer->offset = 0;
@ -96,6 +99,9 @@ restart:
} }
/* Increase the size of the buffer and retry. */ /* Increase the size of the buffer and retry. */
buffer->alloc += len + 32768; 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); buffer->buf = xrealloc(buffer->buf, buffer->alloc);
goto restart; goto restart;
/* NOTREACHED */ /* NOTREACHED */