mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-06 04:46:17 +01:00
[d3d9] Fix long driver/device names not being null terminated
Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
parent
409a6f5c3f
commit
8912c7adb0
@ -43,6 +43,12 @@ namespace dxvk {
|
|||||||
m_adapter->logAdapterInfo();
|
m_adapter->logAdapterInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <size_t N>
|
||||||
|
static void copyToStringArray(char (&dst)[N], const char* src) {
|
||||||
|
std::strncpy(dst, src, N);
|
||||||
|
dst[N - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT D3D9Adapter::GetAdapterIdentifier(
|
HRESULT D3D9Adapter::GetAdapterIdentifier(
|
||||||
DWORD Flags,
|
DWORD Flags,
|
||||||
@ -69,9 +75,9 @@ namespace dxvk {
|
|||||||
const char* desc = options.customDeviceDesc.empty() ? props.deviceName : options.customDeviceDesc.c_str();
|
const char* desc = options.customDeviceDesc.empty() ? props.deviceName : options.customDeviceDesc.c_str();
|
||||||
const char* driver = GetDriverDLL(DxvkGpuVendor(vendorId));
|
const char* driver = GetDriverDLL(DxvkGpuVendor(vendorId));
|
||||||
|
|
||||||
std::strncpy(pIdentifier->Description, desc, std::size(pIdentifier->Description));
|
copyToStringArray(pIdentifier->Description, desc);
|
||||||
std::strncpy(pIdentifier->DeviceName, device.DeviceName, std::size(pIdentifier->DeviceName)); // The GDI device name. Not the actual device name.
|
copyToStringArray(pIdentifier->DeviceName, device.DeviceName); // The GDI device name. Not the actual device name.
|
||||||
std::strncpy(pIdentifier->Driver, driver, std::size(pIdentifier->Driver)); // This is the driver's dll.
|
copyToStringArray(pIdentifier->Driver, driver); // This is the driver's dll.
|
||||||
|
|
||||||
pIdentifier->DeviceIdentifier = guid;
|
pIdentifier->DeviceIdentifier = guid;
|
||||||
pIdentifier->DeviceId = deviceId;
|
pIdentifier->DeviceId = deviceId;
|
||||||
|
Loading…
Reference in New Issue
Block a user