aboutsummaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 27d2592..503a68b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -183,8 +183,10 @@ int buffer_add_data(struct ssh_buffer_struct *buffer, const void *data, uint32_t
if (buffer->allocated < (buffer->used + len)) {
if(buffer->pos > 0)
buffer_shift(buffer);
- if (realloc_buffer(buffer, buffer->used + len) < 0) {
- return -1;
+ if (buffer->allocated < (buffer->used + len)) {
+ if (realloc_buffer(buffer, buffer->used + len) < 0) {
+ return -1;
+ }
}
}