1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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
This commit is contained in:
Timo Sirainen 2001-07-29 01:14:25 +00:00 committed by cras
parent 802ee7564c
commit 6ec7e12967

View File

@ -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;