diff options
author | Adam Jackson <ajax@redhat.com> | 2017-12-13 14:53:56 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-01-22 14:17:58 -0500 |
commit | 71269c6e57cec82bbf81b1c99c8019098303d6a3 (patch) | |
tree | 955c856157df78a5d7790b70a84e8fb64c9ca9a1 /os | |
parent | 8f11ab2b475623d5c00e146a7d6108f356a16b52 (diff) |
os: Fix a type error in the IPv6 XDMCP code
Building with strict-aliasing rightly chirps here:
../os/xdmcp.c: In function ‘XdmcpRegisterConnection’:
../os/xdmcp.c:489:31: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
&((struct sockaddr_in6 *) &address)->sin6_addr.s6_addr[12];
^~~~~~~~~~~~
We have "const char *address", so &address here is a char ** (i.e., it
points to the slot on the stack containing the pointer to the character
array passed in as an argument). Casting that to a struct sockaddr_in6 *
is wrong, because it means that area of the stack will be reinterpreted
as a struct sockaddr_in6.
Instead, cast address, not &address.
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 652913cd9474946bcb29271602bacfd98f46ad0b)
Diffstat (limited to 'os')
-rw-r--r-- | os/xdmcp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/os/xdmcp.c b/os/xdmcp.c index 7aeb393e6..d8c81fbf8 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -486,7 +486,7 @@ XdmcpRegisterConnection(int type, const char *address, int addrlen) IN6_IS_ADDR_V4MAPPED((const struct in6_addr *) address)) { fromAddr = &((struct sockaddr_in *) &FromAddress)->sin_addr; regAddr = - &((struct sockaddr_in6 *) &address)->sin6_addr.s6_addr[12]; + &((struct sockaddr_in6 *) address)->sin6_addr.s6_addr[12]; regAddrlen = sizeof(struct in_addr); } } |