Explorar o código

Added a missing null pointer check in clif_parse_globalmessage

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9827 54d463be-8e91-2dee-dedb-b68131a5f0ec
ultramage %!s(int64=18) %!d(string=hai) anos
pai
achega
81c50c19b7
Modificáronse 2 ficheiros con 6 adicións e 4 borrados
  1. 1 0
      Changelog-Trunk.txt
  2. 5 4
      src/map/clif.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2007/02/08
+	* Added a missing null pointer check in clif_parse_globalmessage
 	* Fixed the new socket code, which was triggering the inactivity timeout
 	  on the servers' listening sockets
 	* Fixed the TURBO code not working since r4468 (parse func never called)

+ 5 - 4
src/map/clif.c

@@ -8524,9 +8524,9 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) {
 
 /*==========================================
  * Validates and processes global messages
- *------------------------------------------
- */
-void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) // S 008c/00f3 <packet len>.w <strz>.?B
+ * S 008c/00f3 <packet len>.w <strz>.?B
+ *------------------------------------------*/
+void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
 {
 	char* message;
 	unsigned int packetlen, messagelen, namelen;
@@ -8549,7 +8549,8 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) // S 008c/00f
 		int i;
 		// special case here - allow some more freedom for frost joke & dazzler 
 		for(i = 0; i < MAX_SKILLTIMERSKILL; i++) // the only way to check ~.~
-			if (sd->ud.skilltimerskill[i]->timer != -1 && (sd->ud.skilltimerskill[i]->skill_id == BA_FROSTJOKE || sd->ud.skilltimerskill[i]->skill_id == DC_SCREAM))
+			if (sd->ud.skilltimerskill[i] && sd->ud.skilltimerskill[i]->timer != -1 &&
+			   (sd->ud.skilltimerskill[i]->skill_id == BA_FROSTJOKE || sd->ud.skilltimerskill[i]->skill_id == DC_SCREAM))
 				break;
 		if (i == MAX_SKILLTIMERSKILL) { // normal message, too long
 			ShowWarning("clif_parse_GlobalMessage: Player '%s' sent a message too long ('%.*s')!", sd->status.name, CHAT_SIZE, message);