summaryrefslogtreecommitdiff
path: root/src/common/mapindex.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2015-01-18 11:37:45 -0200
committershennetsind <ind@henn.et>2015-01-18 11:37:45 -0200
commitd0725afa8363b5f7b0612e087b48013d39339039 (patch)
tree3f521b45f4b0f0d3e7dee31cacfdd78d7be867ab /src/common/mapindex.c
parenta3c4d675ba19df385be5d1e3966c61de7186da57 (diff)
downloadhercules-d0725afa8363b5f7b0612e087b48013d39339039.tar.gz
hercules-d0725afa8363b5f7b0612e087b48013d39339039.tar.bz2
hercules-d0725afa8363b5f7b0612e087b48013d39339039.tar.xz
hercules-d0725afa8363b5f7b0612e087b48013d39339039.zip
Fixing 38 issues
Addressing out of bounds read/write, pointless null checks on already deferenced variables, dead code. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/common/mapindex.c')
-rw-r--r--src/common/mapindex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 0d8a69726..2264721fa 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -48,7 +48,7 @@ const char* mapindex_getmapname_ext(const char* string, char* output) {
size_t len;
- strcpy(buf,string);
+ safestrncpy(buf,string, sizeof(buf));
sscanf(string, "%*[^#]%*[#]%15s", buf);
len = safestrnlen(buf, MAP_NAME_LENGTH);
@@ -154,6 +154,7 @@ int mapindex_init(void) {
switch (sscanf(line, "%12s\t%d", map_name, &index)) {
case 1: //Map with no ID given, auto-assign
index = last_index+1;
+ /* Fall through */
case 2: //Map with ID given
mapindex->addmap(index,map_name);
total++;