Fix buffer overflow in map.c