]> andersk Git - openssh.git/blobdiff - buffer.c
- markus@cvs.openbsd.org 2003/05/11 20:30:25
[openssh.git] / buffer.c
index a1152d1d6f56567f81fff3b34b95f9661714bc4b..ad04b267e0d8c2493860a7c5fd1e067a954c767a 100644 (file)
--- a/buffer.c
+++ b/buffer.c
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: buffer.c,v 1.14 2001/12/19 17:16:13 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 */
@@ -155,7 +161,7 @@ void
 buffer_dump(Buffer *buffer)
 {
        int i;
-       u_char *ucp = (u_char *) buffer->buf;
+       u_char *ucp = buffer->buf;
 
        for (i = buffer->offset; i < buffer->end; i++) {
                fprintf(stderr, "%02x", ucp[i]);
This page took 0.123718 seconds and 4 git commands to generate.