r1084 - trunk/code/botlib

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu May 17 15:30:03 EDT 2007


Author: thilo
Date: 2007-05-17 15:30:02 -0400 (Thu, 17 May 2007)
New Revision: 1084

Modified:
   trunk/code/botlib/be_ai_chat.c
Log:
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.


Modified: trunk/code/botlib/be_ai_chat.c
===================================================================
--- trunk/code/botlib/be_ai_chat.c	2007-05-10 01:39:58 UTC (rev 1083)
+++ trunk/code/botlib/be_ai_chat.c	2007-05-17 19:30:02 UTC (rev 1084)
@@ -367,13 +367,16 @@
 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;




More information about the quake3-commits mailing list