diff options
| author | frosty <frostinator33@airmail.cc> | 2026-10-27 20:31:28 -0400 |
|---|---|---|
| committer | frosty <frostinator33@airmail.cc> | 2026-10-27 20:33:50 -0400 |
| commit | 250898c638f07ace6bc7167faede93113c8fd0db (patch) | |
| tree | 310addbedcaaf76da98df22434a4f4711c8ba963 /src/Proxy/Proxy.c | |
| parent | bd3da2232540ea4c78e7ac35e2c90c38c8a3c410 (diff) | |
refactor: replace potentially unsafe string functions with snprintf
Diffstat (limited to 'src/Proxy/Proxy.c')
| -rw-r--r-- | src/Proxy/Proxy.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Proxy/Proxy.c b/src/Proxy/Proxy.c index 5205bac..15e5b1c 100644 --- a/src/Proxy/Proxy.c +++ b/src/Proxy/Proxy.c @@ -25,8 +25,7 @@ static void generate_random_string(char *buf, size_t len) { void set_proxy_config(const char *proxy_str, int rand_user, int rand_pass) { if (proxy_str && proxy_str[0]) { - strncpy(proxy_url, proxy_str, sizeof(proxy_url) - 1); - proxy_url[sizeof(proxy_url) - 1] = '\0'; + snprintf(proxy_url, sizeof(proxy_url), "%s", proxy_str); } randomize_username = rand_user; randomize_password = rand_pass; @@ -144,7 +143,8 @@ int load_proxy_list(const char *filename) { if (temp_count >= temp_capacity) { temp_capacity *= 2; - Proxy *new_list = (Proxy *)realloc(temp_list, temp_capacity * sizeof(Proxy)); + Proxy *new_list = + (Proxy *)realloc(temp_list, temp_capacity * sizeof(Proxy)); if (!new_list) { free(temp_list); fclose(file); |
