diff --git a/src/lib/commands/look.c b/src/lib/commands/look.c index 493d7826..fffd99b5 100644 --- a/src/lib/commands/look.c +++ b/src/lib/commands/look.c @@ -70,7 +70,7 @@ do_look(int type) if (!snxtitem(&ni, type, player->argp[1], NULL)) return RET_SYN; - bitmap = calloc(WORLD_SZ() / 8, 1); + bitmap = calloc((WORLD_SZ() + 7) / 8, 1); if (!bitmap) { logerror("malloc failed in do_look\n"); pr("Memory error. Tell the deity.\n"); diff --git a/src/lib/commands/spy.c b/src/lib/commands/spy.c index 72918606..b746b3d6 100644 --- a/src/lib/commands/spy.c +++ b/src/lib/commands/spy.c @@ -30,7 +30,7 @@ * Known contributors to this file: * Dave Pare, 1986 * Steve McClure, 1998-2000 - * Markus Armbruster, 2005-2008 + * Markus Armbruster, 2005-2011 */ #include @@ -86,7 +86,7 @@ spy(void) pr("You don't have the BTU's for spying on that scale!\n"); return RET_FAIL; } - bitmap = calloc(WORLD_SZ() / 8, 1); + bitmap = calloc((WORLD_SZ() + 7) / 8, 1); if (!bitmap) { logerror("malloc failed in do_look\n"); pr("Memory error. Tell the deity.\n"); diff --git a/src/lib/subs/maps.c b/src/lib/subs/maps.c index e2c4d890..14e89464 100644 --- a/src/lib/subs/maps.c +++ b/src/lib/subs/maps.c @@ -30,7 +30,7 @@ * Known contributors to this file: * Ken Stevens, 1995 * Steve McClure, 1998 - * Markus Armbruster, 2004-2008 + * Markus Armbruster, 2004-2011 * Ron Koenderink, 2006 */ @@ -148,7 +148,7 @@ draw_map(int bmap, char origin, int map_flags, struct nstr_sect *nsp) } } if (!bitmap) - bitmap = malloc(WORLD_SZ() / 8); + bitmap = malloc((WORLD_SZ() + 7) / 8); if (!wmapbuf || !wmap || !bitmap) { pr("Memory error, tell the deity.\n"); logerror("malloc failed in draw_map\n"); @@ -202,7 +202,7 @@ draw_map(int bmap, char origin, int map_flags, struct nstr_sect *nsp) struct sctstr sect; if (!player->god) { - memset(bitmap, 0, WORLD_SZ() / 8); + memset(bitmap, 0, (WORLD_SZ() + 7) / 8); bitinit2(nsp, bitmap, player->cnum); } while (nxtsct(nsp, §) && !player->aborted) { @@ -221,7 +221,7 @@ draw_map(int bmap, char origin, int map_flags, struct nstr_sect *nsp) int changed = 0; if (!player->god) { - memset(bitmap, 0, WORLD_SZ() / 8); + memset(bitmap, 0, (WORLD_SZ() + 7) / 8); bitinit2(nsp, bitmap, player->cnum); } while (nxtsct(nsp, §) && !player->aborted) {