Pārlūkot izejas kodu

* Labels longer than 23 characters will no longer cause the server to exit immediately (bugreport:4563, since r1213).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/renewal@14494 54d463be-8e91-2dee-dedb-b68131a5f0ec
ai4rei 14 gadi atpakaļ
vecāks
revīzija
b0089b0edc
2 mainītis faili ar 11 papildinājumiem un 9 dzēšanām
  1. 1 0
      Changelog-Renewal.txt
  2. 10 9
      src/map/npc.c

+ 1 - 0
Changelog-Renewal.txt

@@ -8,6 +8,7 @@ Date	Added
 	- Fixed data type inconsistency in @statuspoint and @skillpoint (since r5762, related r13541).
 	- Silenced truncation warnings in CR_ACIDDEMONSTRATION damage calculation and cardfix application (since r13700).
 	- Reformatted unit_blown to make it look cleaner (follow up to r14492).
+	* Labels longer than 23 characters will no longer cause the server to exit immediately (bugreport:4563, since r1213).
 2010/11/22
 	* mail_deliveryfail no longer attempts to log (since r12910) and give items (since r11855), when there is no item attached to the mail (bugreport:3239). [Ai4rei]
 	* Fixed a crash when shutting down char-server (TXT only), after it failed to load storage save data (since r1275). [Ai4rei]

+ 10 - 9
src/map/npc.c

@@ -1940,14 +1940,6 @@ int npc_convertlabel_db(DBKey key, void* data, va_list ap)
 	nullpo_ret(label_list_num = va_arg(ap,int*));
 	nullpo_ret(filepath = va_arg(ap,const char*));
 
-	if( *label_list == NULL )
-	{
-		*label_list = (struct npc_label_list *) aCallocA (1, sizeof(struct npc_label_list));
-		*label_list_num = 0;
-	} else
-		*label_list = (struct npc_label_list *) aRealloc (*label_list, sizeof(struct npc_label_list)*(*label_list_num+1));
-	label = *label_list+*label_list_num;
-
 	// In case of labels not terminated with ':', for user defined function support
 	p = lname;
 	while( ISALNUM(*p) || *p == '_' )
@@ -1958,8 +1950,17 @@ int npc_convertlabel_db(DBKey key, void* data, va_list ap)
 	if( len > 23 )
 	{
 		ShowError("npc_parse_script: label name longer than 23 chars! '%s'\n (%s)", lname, filepath);
-		exit(EXIT_FAILURE);
+		return 0;
 	}
+
+	if( *label_list == NULL )
+	{
+		*label_list = (struct npc_label_list *) aCallocA (1, sizeof(struct npc_label_list));
+		*label_list_num = 0;
+	} else
+		*label_list = (struct npc_label_list *) aRealloc (*label_list, sizeof(struct npc_label_list)*(*label_list_num+1));
+	label = *label_list+*label_list_num;
+
 	safestrncpy(label->name, lname, sizeof(label->name));
 	label->pos = lpos;
 	++(*label_list_num);