Преглед изворни кода

* Fixed a crash when an unknown map is encountered during parsing a 'script' npc and the script has mismatched curly braces (bugreport:4423, since r11502).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14502 54d463be-8e91-2dee-dedb-b68131a5f0ec
ai4rei пре 14 година
родитељ
комит
3541b61e5e
2 измењених фајлова са 13 додато и 2 уклоњено
  1. 1 0
      Changelog-Trunk.txt
  2. 12 2
      src/map/npc.c

+ 1 - 0
Changelog-Trunk.txt

@@ -1,6 +1,7 @@
 Date	Added
 Date	Added
 
 
 2010/11/25
 2010/11/25
+	* Fixed a crash when an unknown map is encountered during parsing a 'script' npc and the script has mismatched curly braces (bugreport:4423, since r11502). [Ai4rei]
 	* Fixed script commands attachrid and detachrid not updating the attached character's information about currently running script, causing errors with dialog-based scripts or preventing characters from walking (bugreport:4571). [Ai4rei]
 	* Fixed script commands attachrid and detachrid not updating the attached character's information about currently running script, causing errors with dialog-based scripts or preventing characters from walking (bugreport:4571). [Ai4rei]
 2010/11/24
 2010/11/24
 	* Fixed party booking search not interpreting level 0 as 'all levels' and using level as upper rather than lower bound (bugreport:4537, since r14412). [Ai4rei]
 	* Fixed party booking search not interpreting level 0 as 'all levels' and using level as upper rather than lower bound (bugreport:4537, since r14412). [Ai4rei]

+ 12 - 2
src/map/npc.c

@@ -3129,7 +3129,12 @@ void npc_parsesrcfile(const char* filepath)
 			{// Incorrect map, we must skip the script info...
 			{// Incorrect map, we must skip the script info...
 				ShowError("npc_parsesrcfile: Unknown map '%s' in file '%s', line '%d'. Skipping line...\n", mapname, filepath, strline(buffer,p-buffer));
 				ShowError("npc_parsesrcfile: Unknown map '%s' in file '%s', line '%d'. Skipping line...\n", mapname, filepath, strline(buffer,p-buffer));
 				if( strcasecmp(w2,"script") == 0 && count > 3 )
 				if( strcasecmp(w2,"script") == 0 && count > 3 )
-					p = npc_skip_script(p,buffer,filepath);
+				{
+					if((p = npc_skip_script(p,buffer,filepath)) == NULL)
+					{
+						break;
+					}
+				}
 				p = strchr(p,'\n');// next line
 				p = strchr(p,'\n');// next line
 				continue;
 				continue;
 			}
 			}
@@ -3137,7 +3142,12 @@ void npc_parsesrcfile(const char* filepath)
 			if( m < 0 )
 			if( m < 0 )
 			{// "mapname" is not assigned to this server, we must skip the script info...
 			{// "mapname" is not assigned to this server, we must skip the script info...
 				if( strcasecmp(w2,"script") == 0 && count > 3 )
 				if( strcasecmp(w2,"script") == 0 && count > 3 )
-					p = npc_skip_script(p,buffer,filepath);
+				{
+					if((p = npc_skip_script(p,buffer,filepath)) == NULL)
+					{
+						break;
+					}
+				}
 				p = strchr(p,'\n');// next line
 				p = strchr(p,'\n');// next line
 				continue;
 				continue;
 			}
 			}