diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-01-10 23:18:45 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-01-10 23:18:45 -0500 |
commit | cbe8639a92a243786b20018666f0289a8b02e025 (patch) | |
tree | 6e47284feae6ec22ee45d5c3e9452cb78ae909ec | |
parent | 880b18ba8b0d061ee2957ab6fa1cc88b7d2f8149 (diff) | |
download | lite-xl-plugin-manager-cbe8639a92a243786b20018666f0289a8b02e025.tar.gz lite-xl-plugin-manager-cbe8639a92a243786b20018666f0289a8b02e025.zip |
Replaced thing.
-rw-r--r-- | src/lpm.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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)); |