summaryrefslogtreecommitdiff
path: root/src/map/map.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/map/map.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/map/map.c')
-rw-r--r--src/map/map.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 7eafde9dc..640dd0ce1 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3353,10 +3353,10 @@ int map_waterheight(char* mapname)
char *rsw, *found;
//Look up for the rsw
- sprintf(fn, "data\\%s.rsw", mapname);
+ snprintf(fn, sizeof(fn), "data\\%s.rsw", mapname);
- found = grfio_find_file(fn);
- if (found) strcpy(fn, found); // replace with real name
+ if ( (found = grfio_find_file(fn)) )
+ safestrncpy(fn, found, sizeof(fn)); // replace with real name
// read & convert fn
rsw = (char *) grfio_read (fn);