diff options
author | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:32:03 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:32:03 +0000 |
commit | 04942aa41fa94ec6f2c3ce1d348f600f31bb7c78 (patch) | |
tree | af8e928bd79d3f2d0219bb5b2c78b573ec31d94c /buffer.c | |
parent | 9ad7b718d42e43f3a285fcbc8f91193931fce324 (diff) | |
parent | 16704d57999d987fb8d9ba53379841a79f016d67 (diff) |
import openssh-4.2p1-gsskex-20050926-2.patch
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: buffer.c,v 1.22 2004/10/29 23:56:17 djm Exp $"); | 15 | RCSID("$OpenBSD: buffer.c,v 1.23 2005/03/14 11:46:56 markus Exp $"); |
16 | 16 | ||
17 | #include "xmalloc.h" | 17 | #include "xmalloc.h" |
18 | #include "buffer.h" | 18 | #include "buffer.h" |
@@ -78,7 +78,7 @@ buffer_append_space(Buffer *buffer, u_int len) | |||
78 | u_int newlen; | 78 | u_int newlen; |
79 | void *p; | 79 | void *p; |
80 | 80 | ||
81 | if (len > 0x100000) | 81 | if (len > BUFFER_MAX_CHUNK) |
82 | fatal("buffer_append_space: len %u not supported", len); | 82 | fatal("buffer_append_space: len %u not supported", len); |
83 | 83 | ||
84 | /* If the buffer is empty, start using it from the beginning. */ | 84 | /* If the buffer is empty, start using it from the beginning. */ |
@@ -97,7 +97,7 @@ restart: | |||
97 | * If the buffer is quite empty, but all data is at the end, move the | 97 | * If the buffer is quite empty, but all data is at the end, move the |
98 | * data to the beginning and retry. | 98 | * data to the beginning and retry. |
99 | */ | 99 | */ |
100 | if (buffer->offset > buffer->alloc / 2) { | 100 | if (buffer->offset > MIN(buffer->alloc, BUFFER_MAX_CHUNK)) { |
101 | memmove(buffer->buf, buffer->buf + buffer->offset, | 101 | memmove(buffer->buf, buffer->buf + buffer->offset, |
102 | buffer->end - buffer->offset); | 102 | buffer->end - buffer->offset); |
103 | buffer->end -= buffer->offset; | 103 | buffer->end -= buffer->offset; |
@@ -107,7 +107,7 @@ restart: | |||
107 | /* Increase the size of the buffer and retry. */ | 107 | /* Increase the size of the buffer and retry. */ |
108 | 108 | ||
109 | newlen = buffer->alloc + len + 32768; | 109 | newlen = buffer->alloc + len + 32768; |
110 | if (newlen > 0xa00000) | 110 | if (newlen > BUFFER_MAX_LEN) |
111 | fatal("buffer_append_space: alloc %u not supported", | 111 | fatal("buffer_append_space: alloc %u not supported", |
112 | newlen); | 112 | newlen); |
113 | buffer->buf = xrealloc(buffer->buf, newlen); | 113 | buffer->buf = xrealloc(buffer->buf, newlen); |