Summary: Lack of "legend" in nations/nation.ruleset leads to
Submitted by: rcbrgs
Submitted on: Thu 30 Aug 2012 12:56:55 AM GMT
Severity: 3 - Normal
Priority: 5 - Normal
Assigned to: None
Discussion Lock: Any
Operating System: Any
If a nation/nation.ruleset lacks a legend specification, the server crashes
when the ruleset is loaded, without warnings, and running the server with -d 3
also does not give a clue about this.
I believe the problem is in common/nation.c, function nation_free, that has
the following line:
since pnation->legend is undefined, this line attempts to free an unallocated
pointer, leading to a segmentation fault. I have verified this by commenting
this line and loading a ruleset with a nation missing its legend, and there is
no segfault in this case.
A quick fix would check if pnation->legend is NULL before freeing it, but I
think it is not unreasonable to think that future coders might assume
pnation->legend is initialized, somewhere else. So a possible permanent
solution is to assign an empty string to pnation->legend if none is specified
in the nation.ruleset.
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list