From 45a855ef1f9cdd44b1feae5e3e0bac52ebaf8410 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 1 Oct 2017 04:00:56 +0300 Subject: [PATCH] Fix cellKb --- rpcs3/Emu/Cell/Modules/cellKb.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rpcs3/Emu/Cell/Modules/cellKb.cpp b/rpcs3/Emu/Cell/Modules/cellKb.cpp index 0112070fb4..7bf6a67b14 100644 --- a/rpcs3/Emu/Cell/Modules/cellKb.cpp +++ b/rpcs3/Emu/Cell/Modules/cellKb.cpp @@ -177,6 +177,9 @@ error_code cellKbSetCodeType(u32 port_no, u32 type) if (!handler) return CELL_KB_ERROR_UNINITIALIZED; + + if (port_no >= handler->GetKeyboards().size()) + return CELL_KB_ERROR_INVALID_PARAMETER; KbConfig& current_config = handler->GetConfig(port_no); current_config.code_type = type; @@ -197,6 +200,9 @@ error_code cellKbSetReadMode(u32 port_no, u32 rmode) if (!handler) return CELL_KB_ERROR_UNINITIALIZED; + + if (port_no >= handler->GetKeyboards().size()) + return CELL_KB_ERROR_INVALID_PARAMETER; KbConfig& current_config = handler->GetConfig(port_no); current_config.read_mode = rmode; @@ -213,6 +219,9 @@ error_code cellKbGetConfiguration(u32 port_no, vm::ptr config) if (!handler) return CELL_KB_ERROR_UNINITIALIZED; + if (port_no >= handler->GetKeyboards().size()) + return CELL_KB_ERROR_INVALID_PARAMETER; + const KbConfig& current_config = handler->GetConfig(port_no); config->arrange = current_config.arrange; config->read_mode = current_config.read_mode;