From d36df02d4cac2a2e595f6c75df4576585cd67dab Mon Sep 17 00:00:00 2001
From: Marc Hoersken <info@marc-hoersken.de>
Date: Tue, 26 Jun 2012 07:27:02 +0200
Subject: [PATCH] sockaddr.h: Fixed dereferencing pointer breakin
 strict-aliasing

Fixed warning: dereferencing pointer does break strict-aliasing rules
by using a union inside the struct Curl_sockaddr_storage declaration.

More information regarding this issue and solution can be found here:
http://stackoverflow.com/a/1432959/834537
---
 lib/sockaddr.h |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lib/sockaddr.h b/lib/sockaddr.h
index c69411b..440eb0a 100644
--- a/lib/sockaddr.h
+++ b/lib/sockaddr.h
@@ -24,14 +24,19 @@
 
 #include "setup.h"
 
-#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
 struct Curl_sockaddr_storage {
-  struct sockaddr_storage buffer;
-};
+  union {
+    struct sockaddr sa;
+    struct sockaddr_in sa_in;
+#ifdef ENABLE_IPV6
+    struct sockaddr_in6 sa_in6;
+#endif
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+    struct sockaddr_storage sa_stor;
 #else
-struct Curl_sockaddr_storage {
-  char buffer[256];   /* this should be big enough to fit a lot */
-};
+    char cbuf[256];   /* this should be big enough to fit a lot */
 #endif
+  } buffer;
+};
 
 #endif /* __SOCKADDR_H */
-- 
1.7.10.msysgit.1

