Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/dxcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ static int dxcore_query_adapter_driverstore(struct dxcore_lib* pLib, unsigned in
free(pValue);
return (-1);
}
wcstombs(*ppDriverStorePath, pOutput, outputSize);
/*
* wcstombs() expects the size of the destination buffer in bytes. The
* buffer allocated above is `outputSize + 1` bytes long, which includes
* room for the terminating NUL byte. Passing only `outputSize` could
* prevent the terminator from being written when the converted string
* length equals `outputSize`. Use the full buffer size here to ensure
* the resulting string is always NUL terminated.
*/
wcstombs(*ppDriverStorePath, pOutput, outputSize + 1);

free(pValue);

Expand Down