From e7f580052c03fa3f4603051c1b718be4bd8b2db7 Mon Sep 17 00:00:00 2001 From: "Nolan \"Tempa Kyouran\" Varani" Date: Sat, 30 Sep 2017 07:17:30 -0500 Subject: [PATCH] Prevent segfault in draw_key_config (#2) Its calculated `y` value can dip below zero This causes a segfault if used as an argument of `text_out16` --- menu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/menu.c b/menu.c index b40a5df..f1b1957 100644 --- a/menu.c +++ b/menu.c @@ -1381,7 +1381,8 @@ static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_ y = (g_menuscreen_h - 4 * me_mfont_h) / 2 - (2 + opt_cnt) * me_mfont_h / 2; if (x < me_mfont_w * 2) x = me_mfont_w * 2; - + if (y < 0) + y = 0; menu_draw_begin(1, 0); if (player_idx >= 0) text_out16(x, y, "Player %i controls", player_idx + 1); -- 2.39.2