@@ -2533,7 +2533,7 @@ PHP_FUNCTION(socket_addrinfo_lookup)
2533
2533
if (strcmp (ZSTR_VAL (key ), "ai_flags" ) == 0 ) {
2534
2534
hints .ai_flags = Z_LVAL_P (hint );
2535
2535
} else if (strcmp (ZSTR_VAL (key ), "ai_socktype" ) == 0 ) {
2536
- hints .ai_socktype = Z_LVAL_P (hint );
2536
+ hints .ai_socktype = Z_LVAL_P (hint );
2537
2537
} else if (strcmp (ZSTR_VAL (key ), "ai_protocol" ) == 0 ) {
2538
2538
hints .ai_protocol = Z_LVAL_P (hint );
2539
2539
} else if (strcmp (ZSTR_VAL (key ), "ai_family" ) == 0 ) {
@@ -2556,8 +2556,8 @@ PHP_FUNCTION(socket_addrinfo_lookup)
2556
2556
res = emalloc (sizeof (struct addrinfo ));
2557
2557
memcpy (res , rp , sizeof (struct addrinfo ));
2558
2558
2559
- res -> ai_addr = emalloc (sizeof ( struct sockaddr ) );
2560
- memcpy (res -> ai_addr , rp -> ai_addr , sizeof ( struct sockaddr ) );
2559
+ res -> ai_addr = emalloc (rp -> ai_addrlen );
2560
+ memcpy (res -> ai_addr , rp -> ai_addr , rp -> ai_addrlen );
2561
2561
2562
2562
if (rp -> ai_canonname != NULL ) {
2563
2563
res -> ai_canonname = estrdup (rp -> ai_canonname );
@@ -2723,7 +2723,7 @@ PHP_FUNCTION(socket_addrinfo_explain)
2723
2723
}
2724
2724
2725
2725
array_init (& sockaddr );
2726
- switch (ai -> ai_addr -> sa_family ) {
2726
+ switch (ai -> ai_family ) {
2727
2727
case AF_INET :
2728
2728
{
2729
2729
struct sockaddr_in * sa = (struct sockaddr_in * ) ai -> ai_addr ;
0 commit comments