gethostbyaddr hook: also set aliases.

i inspected behaviour of libc's and they all seem to set a valid
h_aliases pointer, of which the first one should be NULL, if no
aliases exist.
This commit is contained in:
rofl0r 2012-11-04 04:58:48 +01:00
parent 859dabb302
commit e8d49b02e8

View File

@ -400,6 +400,7 @@ struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
static char buf[16]; static char buf[16];
static char ipv4[4]; static char ipv4[4];
static char *list[2]; static char *list[2];
static char *aliases[1];
static struct hostent he; static struct hostent he;
INIT(); INIT();
@ -419,7 +420,8 @@ struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
list[1] = NULL; list[1] = NULL;
he.h_addr_list = list; he.h_addr_list = list;
he.h_addrtype = AF_INET; he.h_addrtype = AF_INET;
he.h_aliases = NULL; aliases[0] = NULL;
he.h_aliases = aliases;
he.h_length = 4; he.h_length = 4;
pc_stringfromipv4((unsigned char *) addr, buf); pc_stringfromipv4((unsigned char *) addr, buf);
return &he; return &he;