aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-01-10 23:18:45 -0500
committerAdam Harrison <adamdharrison@gmail.com>2023-01-10 23:18:45 -0500
commitcbe8639a92a243786b20018666f0289a8b02e025 (patch)
tree6e47284feae6ec22ee45d5c3e9452cb78ae909ec
parent880b18ba8b0d061ee2957ab6fa1cc88b7d2f8149 (diff)
downloadlite-xl-plugin-manager-cbe8639a92a243786b20018666f0289a8b02e025.tar.gz
lite-xl-plugin-manager-cbe8639a92a243786b20018666f0289a8b02e025.zip
Replaced thing.
-rw-r--r--src/lpm.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lpm.c b/src/lpm.c
index 50190b2..b23d3fe 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -22,7 +22,6 @@
#include <dirent.h>
#include <unistd.h>
#include <fcntl.h>
-#include <math.h>
#include <sys/stat.h>
#include <sys/file.h>
@@ -647,9 +646,9 @@ static int lpm_extract(lua_State* L) {
tar.seek = gzip_seek;
tar.close = gzip_close;*/
char buffer[8192];
- int len = strlen(src);
- strncpy(actual_src, src, min(len - 3, PATH_MAX));
- actual_src[len-3] = 0;
+ int len = strlen(src) - 3;
+ strncpy(actual_src, src, len < PATH_MAX ? len : PATH_MAX);
+ actual_src[len] = 0;
FILE* file = fopen(actual_src, "wb");
while (1) {
int length = gzread(gzfile, buffer, sizeof(buffer));