From 985d4ead12a2007c34903e03dfc7411df1f847fd Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 15 Dec 2015 01:41:18 +0100 Subject: Added validation for the AegisName while parsing the item db Signed-off-by: Haru --- src/map/itemdb.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src') diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 97f302b80..58397a2ee 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1540,6 +1540,30 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { return 0; } + { + const char *c = entry->name; + while (ISALNUM(*c) || *c == '_') + ++c; + + if (*c != '\0') { + ShowWarning("itemdb_validate_entry: Invalid characters in the AegisName '%s' for item %d in '%s'. Skipping.\n", + entry->name, entry->nameid, source); + if (entry->script) { + script->free_code(entry->script); + entry->script = NULL; + } + if (entry->equip_script) { + script->free_code(entry->equip_script); + entry->equip_script = NULL; + } + if (entry->unequip_script) { + script->free_code(entry->unequip_script); + entry->unequip_script = NULL; + } + return 0; + } + } + if( entry->type < 0 || entry->type == IT_UNKNOWN || entry->type == IT_UNKNOWN2 || (entry->type > IT_DELAYCONSUME && entry->type < IT_CASH ) || entry->type >= IT_MAX ) { -- cgit v1.2.3-60-g2f50