aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command.h6
-rw-r--r--src/dxvk.c13
-rw-r--r--src/tar.c2
3 files changed, 12 insertions, 9 deletions
diff --git a/src/command.h b/src/command.h
index 54ce16f..7460d59 100644
--- a/src/command.h
+++ b/src/command.h
@@ -65,9 +65,9 @@
\
for (unsigned long i = 0; i < ARRAY_LEN(GROUP##_flags); ++i) \
{ \
- if (GROUP##_flags[i].variant & SINGLE && argv[j][1] == GROUP##_flags[i].name[0] || \
- GROUP##_flags[i].variant & DOUBLE && argv[j][1] == '-' \
- && !strcmp(GROUP##_flags[i].name, argv[j]+2)) \
+ if ((GROUP##_flags[i].variant & SINGLE && argv[j][1] == GROUP##_flags[i].name[0]) || \
+ (GROUP##_flags[i].variant & DOUBLE && argv[j][1] == '-' \
+ && !strcmp(GROUP##_flags[i].name, argv[j]+2))) \
{ \
return GROUP##_flags[i].func(0, NULL); \
} \
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);
diff --git a/src/tar.c b/src/tar.c
index 0daf657..d11728b 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -108,5 +108,5 @@ void extract(const struct MemoryStruct* tar, const char* outputdir)
archive_write_close(ext);
archive_write_free(ext);
- if (err) chdir(cwd);
+ if (err) (void)chdir(cwd);
}