summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-08 22:56:12 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-08 22:56:12 +0000
commit165ae5d91f798d754db9513da0e2f453f9feeb56 (patch)
treef28e10252b7a8ba55c31e1baa4235a1cbc624b7a
parent8f32131382d5d2d4c469344f1a2337fe5a903850 (diff)
downloadhercules-165ae5d91f798d754db9513da0e2f453f9feeb56.tar.gz
hercules-165ae5d91f798d754db9513da0e2f453f9feeb56.tar.bz2
hercules-165ae5d91f798d754db9513da0e2f453f9feeb56.tar.xz
hercules-165ae5d91f798d754db9513da0e2f453f9feeb56.zip
Fixed item_db parser:
1. map server would crash with mismatching curly braces in unequip script field 2. the parser wouldn't accept specific combinations of curly braces in the uniquip script field. special thanks to mkbu95! git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16878 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/itemdb.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 7ea11ef7a..e0c964de3 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1171,12 +1171,22 @@ static int itemdb_readdb(void)
continue;
}
str[21] = p;
-
- p = strstr(p+1,"}");
- if ( strchr(p,',') != NULL )
- {
- ShowError("itemdb_readdb: Extra columns in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
- continue;
+
+ if ( str[21][strlen(str[21])-2] != '}' ) {
+ /* lets count to ensure it's not something silly e.g. a extra space at line ending */
+ int v, lcurly = 0, rcurly = 0;
+
+ for( v = 0; v < strlen(str[21]); v++ ) {
+ if( str[21][v] == '{' )
+ lcurly++;
+ else if ( str[21][v] == '}' )
+ rcurly++;
+ }
+
+ if( lcurly != rcurly ) {
+ ShowError("itemdb_readdb: Mismatching curly braces in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ continue;
+ }
}
if (!itemdb_parse_dbrow(str, path, lines, 0))