Skip to content

Commit

Permalink
Fix a potential crash bug on 64 bit systems in the botlib library. si…
Browse files Browse the repository at this point in the history
…zeof(bot_consolemessage_t) is different on 64 bit and 32 bit systems.
  • Loading branch information
Thilo Schulz committed May 17, 2007
1 parent 7d13d6c commit 9597d68
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions code/botlib/be_ai_chat.c
Expand Up @@ -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;
Expand Down

0 comments on commit 9597d68

Please sign in to comment.