From 250898c638f07ace6bc7167faede93113c8fd0db Mon Sep 17 00:00:00 2001 From: frosty Date: Tue, 27 Oct 2026 20:31:28 -0400 Subject: refactor: replace potentially unsafe string functions with snprintf --- src/Proxy/Proxy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Proxy') 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); -- cgit v1.3