From e785879df0519ee69afcac34a1b49db1462d67fc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Sep 2014 19:41:38 +0300 Subject: Fix on start possible buffer overruns. Checks after using --enable-sanitize. --- src/common/mapindex.c | 2 +- src/map/npc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/mapindex.c b/src/common/mapindex.c index f540c98d8..0873b3e59 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -138,7 +138,7 @@ int mapindex_init(void) { char line[1024]; int last_index = -1; int index, total = 0; - char map_name[12]; + char map_name[13]; if( ( fp = fopen(mapindex->config_file,"r") ) == NULL ){ ShowFatalError("Unable to read mapindex config file %s!\n", mapindex->config_file); diff --git a/src/map/npc.c b/src/map/npc.c index f1c6f4fbd..f4f20a60d 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3447,7 +3447,7 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st // w4=,,,,{,,} if( sscanf(w1, "%31[^,],%d,%d,%d,%d", mapname, &x, &y, &xs, &ys) < 3 || sscanf(w3, "%23[^,],%d", mobname, &mob_lv) < 1 - || sscanf(w4, "%d,%d,%u,%u,%127[^,],%d,%d[^\t\r\n]", &class_, &num, &mobspawn.delay1, &mobspawn.delay2, mobspawn.eventname, &size, &ai) < 2 + || sscanf(w4, "%d,%d,%u,%u,%50[^,],%d,%d[^\t\r\n]", &class_, &num, &mobspawn.delay1, &mobspawn.delay2, mobspawn.eventname, &size, &ai) < 2 ) { ShowError("npc_parse_mob: Invalid mob definition in file '%s', line '%d'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4); if (retval) *retval = EXIT_FAILURE; -- cgit v1.2.3-60-g2f50