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:
parent
802ee7564c
commit
6ec7e12967
@ -151,7 +151,8 @@ static void text_chunk_append(TEXT_BUFFER_REC *buffer,
|
|||||||
chunk = buffer->cur_text;
|
chunk = buffer->cur_text;
|
||||||
while (chunk->pos + len >= TEXT_CHUNK_USABLE_SIZE) {
|
while (chunk->pos + len >= TEXT_CHUNK_USABLE_SIZE) {
|
||||||
left = TEXT_CHUNK_USABLE_SIZE - chunk->pos;
|
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);
|
memcpy(chunk->buffer + chunk->pos, data, left);
|
||||||
chunk->pos += left;
|
chunk->pos += left;
|
||||||
|
Loading…
Reference in New Issue
Block a user