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.pull/348/head
parent
7fe8139496
commit
c99d97983e
|
@ -749,7 +749,7 @@ struct hostent* proxy_gethostbyname_old(const char *name)
|
||||||
static struct hostent hostent_space;
|
static struct hostent hostent_space;
|
||||||
static in_addr_t resolved_addr;
|
static in_addr_t resolved_addr;
|
||||||
static char* resolved_addr_p;
|
static char* resolved_addr_p;
|
||||||
static char addr_name[1024*8];
|
static char addr_name[256];
|
||||||
|
|
||||||
int pipe_fd[2];
|
int pipe_fd[2];
|
||||||
char buff[256];
|
char buff[256];
|
||||||
|
|
|
@ -117,7 +117,7 @@ struct gethostbyname_data {
|
||||||
struct hostent hostent_space;
|
struct hostent hostent_space;
|
||||||
in_addr_t resolved_addr;
|
in_addr_t resolved_addr;
|
||||||
char *resolved_addr_p[2];
|
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);
|
struct hostent* proxy_gethostbyname(const char *name, struct gethostbyname_data *data);
|
||||||
|
|
Loading…
Reference in New Issue