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

View file

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