@miconda regarding to this change
- *from = &si->su;
+ memcpy(*from, &si->su, sockaddru_len(si->su));
This change is made within the function find_listening_sock_info
. The function declaration looks as follows:
inline static int find_listening_sock_info(
int s, union sockaddr_union **from, int type)
The from
param is a pointer to pointer. It's presumed that at the moment when find_listening_sock_info
is called the memory for from
param should be already allocated.
This function is called in only a single place in the source code - here - and *from
pointer refers to the my_name
variable, which is a variable allocated on the stack.
So this memcpy
function is copying the memory from si->su
structure object into the my_name
variable allocated on the stack. I do not see here anything incorrect.
However, maybe the passing of the from
param as a pointer to pointer (union sockaddr_union **from
) can be changed to passing as a pointer (union sockaddr_union *from
) - to exclude a confision.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.