From 6ec7e12967f89e36455ff985871d99f81bd8d01e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 29 Jul 2001 01:14:25 +0000 Subject: Added a small sanity check - the condition should never happen, but it seems to have happened with one guy.. perhaps something else had corrupted memory. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1665 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/textbuffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/fe-text') diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c index 3c11aea3..105e192a 100644 --- a/src/fe-text/textbuffer.c +++ b/src/fe-text/textbuffer.c @@ -151,7 +151,8 @@ static void text_chunk_append(TEXT_BUFFER_REC *buffer, chunk = buffer->cur_text; while (chunk->pos + len >= TEXT_CHUNK_USABLE_SIZE) { left = TEXT_CHUNK_USABLE_SIZE - chunk->pos; - if (data[left-1] == 0) left--; /* don't split the commands */ + if (left > 0 && data[left-1] == 0) + left--; /* don't split the commands */ memcpy(chunk->buffer + chunk->pos, data, left); chunk->pos += left; -- cgit v1.2.3