From d0725afa8363b5f7b0612e087b48013d39339039 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sun, 18 Jan 2015 11:37:45 -0200 Subject: 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 --- src/map/map.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/map/map.c') 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); -- cgit v1.2.3-60-g2f50