/*
- * Copyright (c) 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2009, 2011 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
switch (sa->sa_family) {
case AF_INET :
- ((struct sockaddr_in *)sa)->sin_port = port;
+ /* ALIGN: cast ok, sockaddr was malloc'd */
+ ((struct sockaddr_in *)(void *)sa)->sin_port = port;
break;
case AF_INET6 :
- ((struct sockaddr_in6 *)sa)->sin6_port = port;
+ /* ALIGN: cast ok, sockaddr was malloc'd */
+ ((struct sockaddr_in6 *)(void *)sa)->sin6_port = port;
break;
}
}
// if not AF_INET
goto done;
} else {
- addr = ((struct sockaddr_in *)sa)->sin_addr;
+ /* ALIGN: cast ok, sockaddr was malloc'd */
+ addr = ((struct sockaddr_in *)(void *)sa)->sin_addr;
free(sa);
sa = NULL;
}
// if mask not AF_INET
goto done;
} else {
- mask = ((struct sockaddr_in *)sa)->sin_addr;
+ /* ALIGN: cast ok, sockaddr was malloc'd */
+ mask = ((struct sockaddr_in *)(void *)sa)->sin_addr;
free(sa);
sa = NULL;
}