From e75af5f531c0ddabffbc7f028296b18fd98ee036 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 3 Oct 2018 20:49:07 +0200 Subject: [PATCH] Linux: Include the null byte in joystick path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This potential bug was found thanks to gcc 8’s -Wstringop-truncation warning. --- src/linux_joystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linux_joystick.c b/src/linux_joystick.c index 2777d0b3..baa3651b 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -228,7 +228,7 @@ static GLFWbool openJoystickDevice(const char* path) return GLFW_FALSE; } - strncpy(linjs.path, path, sizeof(linjs.path)); + strncpy(linjs.path, path, sizeof(linjs.path) - 1); memcpy(&js->linjs, &linjs, sizeof(linjs)); pollAbsState(js);