segfault when selecting unit

Bug #471341 reported by Christofer Beijar-Odén
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rawcese
Fix Committed
Undecided
Christofer Beijar-Odén

Bug Description

Segfaulting right after printfing unit health when selecting a unit, either by tab or mouse click.
No segfault while viewing unselected unit.

Revision history for this message
Christofer Beijar-Odén (spektre) wrote :

Found it somewhere in the interface status message, trying to fix it.
Emil!

Changed in rawcese:
status: New → In Progress
assignee: nobody → spektre (spektre)
Revision history for this message
Christofer Beijar-Odén (spektre) wrote :

Buffer overflow here:
char hp[10];
sprintf(hp,"Hp: %d of %d ",unit->get_health(),unit->get_maxhealth());

string is longer than 10 chars

Revision history for this message
Christofer Beijar-Odén (spektre) wrote :

Rewriting with c++ type stringstream
I think we'll use printfs for debugging, but when manipulating string like this it's nice to use these c++ functions and types.

Revision history for this message
Christofer Beijar-Odén (spektre) wrote :

Fixed!

Changed in rawcese:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.