aboutsummaryrefslogtreecommitdiff
path: root/src/dxvk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dxvk.c')
-rw-r--r--src/dxvk.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/dxvk.c b/src/dxvk.c
index 9b4a5f6..34790cd 100644
--- a/src/dxvk.c
+++ b/src/dxvk.c
@@ -182,11 +182,14 @@ COMMAND(dxvk, install)
{
// quote the dxvkpath so whitespace won't cause trouble
{
- char dxvkpathcpy[PATH_MAX] = {0};
- strncat(dxvkpathcpy, "\"", sizeof(dxvkpathcpy) - strlen(dxvkpathcpy) - 1);
- strncat(dxvkpathcpy, dxvkpath, sizeof(dxvkpathcpy) - strlen(dxvkpathcpy) - 1);
- strncat(dxvkpathcpy, "\"", sizeof(dxvkpathcpy) - strlen(dxvkpathcpy) - 1);
- strncpy(dxvkpath, dxvkpathcpy, sizeof(dxvkpathcpy));
+ size_t size = strlen(dxvkpath) + 1;
+ if (size > sizeof(dxvkpath)) size = sizeof(dxvkpath);
+
+ memmove(dxvkpath+1, dxvkpath, size - 1);
+ dxvkpath[0] = '"';
+
+ strncat(dxvkpath, "\"", sizeof(dxvkpath) - size);
+
}
strncat(dxvkpath, " install", sizeof(dxvkpath) - strlen(dxvkpath) - 1);