From 486f8200ad9ab5c0726f021912cff09a6a21261c Mon Sep 17 00:00:00 2001 From: rofl0r Date: Mon, 26 Oct 2020 03:03:08 +0000 Subject: [PATCH] tunnel_to: shrink huge buffer size the buffer buff was only used for the initial handshake packets, which in all supported protocols are usual less than a 100 bytes, with user/pass and dns name at maximum we'd require 768 bytes, which still leaves us a formidable 256 bytes for the rest of the packet. this fixes a segfault with microsocks which on musl uses tiny thread stack sizes of 8KB. --- src/core.c | 1 + src/core.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index f5e7ce9..4226a7e 100644 --- a/src/core.c +++ b/src/core.c @@ -188,6 +188,7 @@ static int timed_connect(int sock, const struct sockaddr *addr, socklen_t len) { #define INVALID_INDEX 0xFFFFFFFFU +#define BUFF_SIZE 1024 // used to read responses from proxies. static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt, char *user, char *pass) { char *dns_name = NULL; char hostnamebuf[MSG_LEN_MAX]; diff --git a/src/core.h b/src/core.h index acb0152..fd9b6c8 100644 --- a/src/core.h +++ b/src/core.h @@ -23,7 +23,6 @@ #ifndef __CORE_HEADER #define __CORE_HEADER -#define BUFF_SIZE 8*1024 // used to read responses from proxies. #define MAX_LOCALNET 64 #define MAX_DNAT 64