summaryrefslogtreecommitdiff
path: root/src/common/mapindex.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-17 22:37:31 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-18 01:48:00 +0300
commit3bf50615cd8a85bec21d0dab1ecf39a26c0e104b (patch)
tree4d70b665497abc5e477907c2aec1543b1d1df2b6 /src/common/mapindex.c
parent1ea16746b1330656e152278a7192e5b7adef0539 (diff)
downloadhercules-3bf50615cd8a85bec21d0dab1ecf39a26c0e104b.tar.gz
hercules-3bf50615cd8a85bec21d0dab1ecf39a26c0e104b.tar.bz2
hercules-3bf50615cd8a85bec21d0dab1ecf39a26c0e104b.tar.xz
hercules-3bf50615cd8a85bec21d0dab1ecf39a26c0e104b.zip
Fix out of bound issue in mapindex.c.
Found by coverity scan.
Diffstat (limited to 'src/common/mapindex.c')
-rw-r--r--src/common/mapindex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 0d8a69726..79125e010 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -126,7 +126,7 @@ unsigned short mapindex_name2id(const char* name) {
}
const char* mapindex_id2name_sub(unsigned short id,const char *file, int line, const char *func) {
- if (id > MAX_MAPINDEX || !mapindex_exists(id)) {
+ if (id >= MAX_MAPINDEX || !mapindex_exists(id)) {
ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache. %s:%s:%d\n", id,file,func,line);
return mapindex->list[0].name; // dummy empty string so that the callee doesn't crash
}