Added dummy %s to prevent formatting untrusted literals - patch by Kp

This commit is contained in:
zicodxx 2013-01-03 17:29:57 +01:00
parent b5b72b3ae3
commit 1ba045abe5
8 changed files with 12 additions and 11 deletions

View file

@ -16,6 +16,7 @@ medrobot.c: medrobot: avoid needless name copy - patch by Kp
editor/centers.c, main/gamecntl.c: Fixed argument specifier mismatches flagged by -Wformat - patch by Kp
arch/ogl/gr.c, main/game.c: Moved screenshot message formating to HUD_init_message - patch by Kp (and me for non-OGL code ;))
main/automap.c, main/credits.c, main/gamerend.c, main/gauges.c, main/hud.c, main/kmatrix.c, main/menu.c, main/newmenu.c, main/scores.c: Converted gr_printf to gr_string where needed - patch by Kp
editor/medrobot.c, main/endlevel.c, main/gamecntl.c, main/powerup.c, main/wall.c, main/weapon.c, ui/file.c: Added dummy "%s" to prevent formatting untrusted literals - patch by Kp
20121102
--------

View file

@ -705,8 +705,8 @@ int robot_dialog_handler(UI_DIALOG *dlg, d_event *event, robot_dialog *r)
break;
}
ui_dprintf_at( MainWindow, GOODY_X+108, GOODY_Y, type_text);
ui_dprintf_at( MainWindow, GOODY_X+108, GOODY_Y+24, id_text);
ui_dprintf_at( MainWindow, GOODY_X+108, GOODY_Y, "%s", type_text);
ui_dprintf_at( MainWindow, GOODY_X+108, GOODY_Y+24, "%s", id_text);
ui_dprintf_at( MainWindow, GOODY_X+108, GOODY_Y+48, "%i", Cur_goody_count);
if ( Cur_object_index > -1 ) {

View file

@ -302,7 +302,7 @@ void start_endlevel_sequence()
start_endlevel_flythrough(0,ConsoleObject,cur_fly_speed); //initialize
HUD_init_message(HM_DEFAULT, TXT_EXIT_SEQUENCE );
HUD_init_message(HM_DEFAULT, TXT_EXIT_SEQUENCE );
outside_mine = ext_expl_playing = 0;

View file

@ -998,7 +998,7 @@ int FinalCheats(int key)
if (cheat_codes[gotcha].stateptr == &cheats.wowie)
{
HUD_init_message(HM_DEFAULT, TXT_WOWIE_ZOWIE);
HUD_init_message(HM_DEFAULT, "%s", TXT_WOWIE_ZOWIE);
Players[Player_num].primary_weapon_flags |= 0xff ^ (HAS_PLASMA_FLAG | HAS_FUSION_FLAG);
Players[Player_num].secondary_weapon_flags |= 0xff ^ (HAS_SMART_FLAG | HAS_MEGA_FLAG);
@ -1040,7 +1040,7 @@ int FinalCheats(int key)
if (cheat_codes[gotcha].stateptr == &cheats.allkeys)
{
HUD_init_message(HM_DEFAULT, TXT_ALL_KEYS);
HUD_init_message(HM_DEFAULT, "%s", TXT_ALL_KEYS);
Players[Player_num].flags |= PLAYER_FLAGS_BLUE_KEY | PLAYER_FLAGS_RED_KEY | PLAYER_FLAGS_GOLD_KEY;
}
@ -1064,7 +1064,7 @@ int FinalCheats(int key)
if (cheat_codes[gotcha].stateptr == &cheats.shields)
{
HUD_init_message(HM_DEFAULT, TXT_FULL_SHIELDS);
HUD_init_message(HM_DEFAULT, "%s", TXT_FULL_SHIELDS);
Players[Player_num].shields = MAX_SHIELDS;
}

View file

@ -122,7 +122,7 @@ void powerup_basic(int redadd, int greenadd, int blueadd, int score, char *forma
PALETTE_FLASH_ADD(redadd,greenadd,blueadd);
HUD_init_message(HM_DEFAULT, text);
HUD_init_message(HM_DEFAULT, "%s", text);
add_points_to_score(score);

View file

@ -856,7 +856,7 @@ int wall_hit_process(segment *seg, int side, fix damage, int playernum, object *
if ((w->flags & WALL_DOOR_LOCKED ) && !(special_boss_opening_allowed(seg-Segments, side)) ) {
if ( playernum==Player_num )
if (show_message)
HUD_init_message(HM_DEFAULT, TXT_CANT_OPEN_DOOR);
HUD_init_message(HM_DEFAULT, "%s", TXT_CANT_OPEN_DOOR);
return WHP_NO_KEY;
}
else {

View file

@ -322,7 +322,7 @@ void auto_select_weapon(int weapon_type)
{
if (looped)
{
HUD_init_message(HM_DEFAULT, TXT_NO_PRIMARY);
HUD_init_message(HM_DEFAULT, "%s", TXT_NO_PRIMARY);
select_weapon(0, 0, 0, 1);
try_again = 0;
continue;
@ -341,7 +341,7 @@ void auto_select_weapon(int weapon_type)
// continue;
if (PlayerCfg.PrimaryOrder[cur_weapon] == Primary_weapon) {
HUD_init_message(HM_DEFAULT, TXT_NO_PRIMARY);
HUD_init_message(HM_DEFAULT, "%s", TXT_NO_PRIMARY);
select_weapon(0, 0, 0, 1);
try_again = 0; // Tried all weapons!

View file

@ -130,7 +130,7 @@ static int browser_handler(UI_DIALOG *dlg, d_event *event, browser *b)
if (event->type == EVENT_UI_DIALOG_DRAW)
{
ui_dprintf_at( dlg, 10, 5, b->message );
ui_dprintf_at( dlg, 10, 5, "%s", b->message );
ui_dprintf_at( dlg, 20, 32,"N&ame" );
ui_dprintf_at( dlg, 20, 86,"&Files" );