diff --git a/src/core.c b/src/core.c index b8fe08a..83bbe8a 100644 --- a/src/core.c +++ b/src/core.c @@ -175,21 +175,16 @@ static void encode_base_64(char *src, char *dest, int max_len) { *dest++ = 0; } -#define LOG_BUFF 1024*20 - -int proxychains_write_log(char *str, ...) { - char buff[LOG_BUFF]; +void proxychains_write_log(char *str, ...) { + char buff[1024*20]; va_list arglist; - FILE *log_file; - log_file = stderr; if(!proxychains_quiet_mode) { va_start(arglist, str); - vsprintf(buff, str, arglist); + vsnprintf(buff, sizeof(buff), str, arglist); va_end(arglist); - fprintf(log_file, "%s", buff); - fflush(log_file); + fprintf(stderr, "%s", buff); + fflush(stderr); } - return EXIT_SUCCESS; } static int write_n_bytes(int fd, char *buff, size_t size) { diff --git a/src/core.h b/src/core.h index b1521f7..e0b9f0f 100644 --- a/src/core.h +++ b/src/core.h @@ -102,7 +102,7 @@ int connect_proxy_chain (int sock, ip_type target_ip, unsigned short target_port proxy_data * pd, unsigned int proxy_count, chain_type ct, unsigned int max_chain ); -int proxychains_write_log(char *str,...); +void proxychains_write_log(char *str, ...); typedef int (*connect_t)(int, const struct sockaddr *, socklen_t); typedef struct hostent* (*gethostbyname_t)(const char *);