You do know that most of the MAX_MAP_STUFF #defines are arbitrary constants, right ? Zoner used them in his compile tools but they do not reflect the maximal capacity a map can be. You may want to increase them if you intend to read really large maps, especially some with lots of entities.
Here's the ones I use for my BSP reader. I don't read the entdata lump but I'm pretty certain that the MAX_ for the entdata lump is arbitrary as well.
Code:
// BSP map file constants
#define MAX_MAP_HULLS 4 // hard limit
#define MAX_MAP_MODELS 400 // variable, but more would stress out the engine and network code
#define MAX_MAP_PLANES 32767 // more than this in a map and the engine will drop faces
#define MAX_MAP_VERTS 65535 // hard limit (data structures store them as unsigned shorts)
#define MAX_MAP_FACES 65535 // hard limit (data structures store them as unsigned shorts)
#define MAX_MAP_EDGES 256000 // arbitrary
#define MAX_MAP_SURFEDGES 512000 // arbitrary
I can almost bet your problem comes from here.