Check scancode before use in glfwGetKeyName

This commit is contained in:
Camilla Löwy
2020-01-15 16:34:58 +01:00
parent a491b0698c
commit 5f1631cb0e
4 changed files with 23 additions and 0 deletions
+7
View File
@@ -2026,6 +2026,13 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
const char* _glfwPlatformGetScancodeName(int scancode)
{
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
return NULL;
}
return _glfw.win32.keynames[_glfw.win32.keycodes[scancode]];
}