mirror of
https://github.com/haad/proxychains.git
synced 2026-09-12 19:50:06 +05:00
Replace inet_ntoa which is not thread safe by re-entrant threadsafe inet_ntop.
This commit is contained in:
parent
952a039801
commit
d28cf03c61
2
Makefile
2
Makefile
@ -17,7 +17,7 @@ SRCS = $(sort $(wildcard src/*.c))
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
LOBJS = src/core.o src/libproxychains.o
|
||||
|
||||
CCFLAGS = -Wall -O0 -g -std=c99 -D_GNU_SOURCE -D_BSD_SOURCE -pipe -DTHREAD_SAFE -Werror
|
||||
CCFLAGS = -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DTHREAD_SAFE -Werror
|
||||
LDFLAGS = -shared -fPIC -ldl -lpthread
|
||||
INC =
|
||||
PIC = -fPIC
|
||||
|
||||
@ -18,9 +18,6 @@
|
||||
#undef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#undef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
@ -456,9 +453,6 @@ struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type)
|
||||
static char ipv4[4];
|
||||
static char* list[2];
|
||||
static struct hostent he;
|
||||
struct in_addr ip;
|
||||
|
||||
memcpy((void *) &ip, addr, sizeof(struct in_addr));
|
||||
|
||||
if(!init_l)
|
||||
init_lib();
|
||||
@ -480,7 +474,7 @@ struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type)
|
||||
he.h_addrtype = AF_INET;
|
||||
he.h_aliases = NULL;
|
||||
he.h_length = 4;
|
||||
snprintf(buf, 16, "%s", inet_ntoa(ip));
|
||||
inet_ntop(AF_INET, addr, buf, sizeof(buf));
|
||||
return &he;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user