mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00: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:
parent
dcd2a19d90
commit
e75af5f531
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user