1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Linux: Include the null byte in joystick path

This potential bug was found thanks to gcc 8’s -Wstringop-truncation
warning.
This commit is contained in:
Emmanuel Gil Peyrot 2018-10-03 20:49:07 +02:00 committed by linkmauve
parent dcd2a19d90
commit e75af5f531

View File

@ -228,7 +228,7 @@ static GLFWbool openJoystickDevice(const char* path)
return GLFW_FALSE; return GLFW_FALSE;
} }
strncpy(linjs.path, path, sizeof(linjs.path)); strncpy(linjs.path, path, sizeof(linjs.path) - 1);
memcpy(&js->linjs, &linjs, sizeof(linjs)); memcpy(&js->linjs, &linjs, sizeof(linjs));
pollAbsState(js); pollAbsState(js);