From 0964444e06b767de24dfe70d75ac180f9074a7fd Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 25 Apr 2018 19:50:51 -0500 Subject: [PATCH] prevent crashing in cores that don't range check retro_set_controller_port --- command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command.c b/command.c index 64b4f9f5f4..1a279788d8 100644 --- a/command.c +++ b/command.c @@ -1015,7 +1015,7 @@ static void command_event_init_controllers(void) /* Ideally these checks shouldn't be required but if we always * call core_set_controller_port_device input won't work on * cores that don't set port information properly */ - if (info && info->ports.size != 0 && i < info->ports.size) + if (info && info->ports.size != 0) set_controller = true; break; default: @@ -1029,7 +1029,7 @@ static void command_event_init_controllers(void) break; } - if (set_controller) + if (set_controller && i < info->ports.size) { pad.device = device; pad.port = i;