mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-05-12 11:43:16 -04:00
quake: fix crash from strange printf behavior (FS#13821)
This was a latent bug exposed by commit a3f2b64a46
("Enable float formatting in printf"). The version
number is passed as 1.09f, but somehow ends up printing
a string that is so huge it overruns the destination
buffer and corrupts the return address on the stack.
Using snprintf prevents the buffer overrun and gets
quake working again, though this doesn't address the
underlying bug with printf.
Change-Id: I37e4426bc6ebca42d83b5a3b659da497b652d1ae
This commit is contained in:
parent
e661c35b29
commit
f9a5d6fe86
1 changed files with 1 additions and 1 deletions
|
|
@ -548,7 +548,7 @@ void Draw_ConsoleBackground (int lines)
|
|||
conback = Draw_CachePic ("gfx/conback.lmp");
|
||||
|
||||
dest = conback->data + 320 - 43 + 320*186;
|
||||
sprintf (ver, "%.2f", (float)VERSION);
|
||||
snprintf (ver, sizeof(ver), "%.2f", (float)VERSION);
|
||||
|
||||
for (x=0 ; x<strlen(ver) ; x++)
|
||||
Draw_CharToConback (ver[x], dest+(x<<3));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue