Fixes a smashing stack problem as described in https://bugzilla.kernel.org/show_bug.cgi?id=104601

This commit is contained in:
Matthieu Coudron 2015-09-15 18:11:58 +02:00
parent fe1c2246a4
commit eb3faee64f

View File

@ -457,10 +457,11 @@ setnonblocking(int fd, int nonblocking)
int
getsockdomain(int sock)
{
struct sockaddr sa;
struct sockaddr_storage sa;
socklen_t len = sizeof(sa);
if (getsockname(sock, &sa, &len) < 0)
return -1;
return sa.sa_family;
if (getsockname(sock, (struct sockaddr *)&sa, &len) < 0) {
return -1;
}
return ((struct sockaddr *) &sa)->sa_family;
}