summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/mmo.h1
-rw-r--r--src/map/pc.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 681c78520..a0634d025 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -563,6 +563,7 @@ enum {
GD_RESTORE=10012,
GD_EMERGENCYCALL=10013,
GD_DEVELOPMENT=10014,
+ GD_MAX,
};
diff --git a/src/map/pc.c b/src/map/pc.c
index 9af3c9213..fc0769b57 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4543,12 +4543,19 @@ int pc_memo(struct map_session_data* sd, int pos)
int pc_checkskill(struct map_session_data *sd,int skill_id)
{
if(sd == NULL) return 0;
- if( skill_id>=GD_SKILLBASE){
+ if( skill_id >= GD_SKILLBASE && skill_id < GD_MAX )
+ {
struct guild *g;
+
if( sd->status.guild_id>0 && (g=guild_search(sd->status.guild_id))!=NULL)
return guild_checkskill(g,skill_id);
return 0;
}
+ else if( skill_id < 0 || skill_id >= ARRAYLENGTH(sd->status.skill) )
+ {
+ ShowError("pc_checkskill: Invalid skill id %d (char_id=%d).\n", skill_id, sd->status.char_id);
+ return 0;
+ }
if(sd->status.skill[skill_id].id == skill_id)
return (sd->status.skill[skill_id].lv);