diff options
author | rofl0r <rofl0r@users.noreply.github.com> | 2020-10-26 05:53:29 +0300 |
---|---|---|
committer | rofl0r <rofl0r@users.noreply.github.com> | 2020-10-26 05:53:29 +0300 |
commit | c99d97983e66e80869416f010b6730ca98de8b01 (patch) | |
tree | a1152e1c3d3637e2633f0830f4fc8e7b1e5762c2 | |
parent | 7fe813949644b115b0127279517dc7c0ee2d63b9 (diff) |
shrink huge gethostbyname buffer
careful analysis has shown that the buffer is only ever used for
at most a single hostname, so 256 bytes are sufficient.
the huge 8KB buffer caused stack overflow when used with microsocks,
which defaults to tiny thread stacks of 8KB with musl libc.
-rw-r--r-- | src/core.c | 2 | ||||
-rw-r--r-- | src/core.h | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -749,7 +749,7 @@ struct hostent* proxy_gethostbyname_old(const char *name) static struct hostent hostent_space; static in_addr_t resolved_addr; static char* resolved_addr_p; - static char addr_name[1024*8]; + static char addr_name[256]; int pipe_fd[2]; char buff[256]; @@ -117,7 +117,7 @@ struct gethostbyname_data { struct hostent hostent_space; in_addr_t resolved_addr; char *resolved_addr_p[2]; - char addr_name[1024 * 8]; + char addr_name[256]; }; struct hostent* proxy_gethostbyname(const char *name, struct gethostbyname_data *data); |