{
const char *text = Cmd_Argv(cmd, 2);
current = Cbuf_LinkGet(cbuf, NULL);
- current->size = strlen(text);
+ current->length = strlen(text);
current->source = cmd;
current->delay = atof(Cmd_Argv(cmd, 1));
- memcpy(current->text, text, current->size + 1);
+ if(current->size < current->length)
+ {
+ current->text = (char *)Mem_Realloc(cbuf_mempool, current->text, current->length + 1);
+ current->size = current->length;
+ }
- List_Move_Tail(¤t->list, &cbuf->deferred);
+ strlcpy(current->text, text, current->length + 1);
+ List_Move_Tail(¤t->list, &cbuf->deferred);
}
else
{
Cbuf_Lock(cbuf);
// we need to memmove the existing text and stuff this in before it...
- if (cbuf->size + l >= (size_t)cbuf->maxsize)
+ if (cbuf->size + l >= cbuf->maxsize)
Con_Print("Cbuf_InsertText: overflow\n");
else
{