Fix a potential crash bug on 64 bit systems in the botlib library. sizeof(bot_consolemessage_t) is different on 64 bit and 32 bit systems.

This commit is contained in:
Thilo Schulz 2007-05-17 19:30:02 +00:00
parent 7d13d6cd3b
commit 9597d684f9
1 changed files with 6 additions and 3 deletions

View File

@ -367,13 +367,16 @@ void BotQueueConsoleMessage(int chatstate, int type, char *message)
int BotNextConsoleMessage(int chatstate, bot_consolemessage_t *cm)
{
bot_chatstate_t *cs;
bot_consolemessage_t *firstmsg;
cs = BotChatStateFromHandle(chatstate);
if (!cs) return 0;
if (cs->firstmessage)
if ((firstmsg = cs->firstmessage))
{
Com_Memcpy(cm, cs->firstmessage, sizeof(bot_consolemessage_t));
cm->next = cm->prev = NULL;
cm->handle = firstmsg->handle;
cm->time = firstmsg->time;
cm->type = firstmsg->type;
Q_strncpyz(cm->message, firstmsg->message, sizeof(cm->message));
return cm->handle;
} //end if
return 0;