[openssl-commits] [openssl] master update

Kurt Roeckx kurt at openssl.org
Thu Feb 4 10:06:41 UTC 2016


The branch master has been updated
       via  37e3daf4a1511b1dea8cea627945a105999d0d6b (commit)
      from  47c1a0e06e2f25d8bf6c6568ba4e3a11fdae422a (commit)


- Log -----------------------------------------------------------------
commit 37e3daf4a1511b1dea8cea627945a105999d0d6b
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Thu Feb 4 01:59:20 2016 +0100

    Make fallback addresses static so that we can initialize it
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    
    MR: #1841

-----------------------------------------------------------------------

Summary of changes:
 crypto/bio/b_addr.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index ed267e9..8f94fe8 100644
--- a/crypto/bio/b_addr.c
+++ b/crypto/bio/b_addr.c
@@ -672,18 +672,20 @@ int BIO_lookup(const char *host, const char *service,
         }
     } else {
 #endif
-        struct hostent *he;
+        const struct hostent *he;
         /* Windows doesn't seem to have in_addr_t */
 #ifdef OPENSSL_SYS_WINDOWS
-        uint32_t he_fallback_address = INADDR_ANY;
-        uint32_t *he_fallback_addresses[] = { &he_fallback_address, NULL };
+        static uint32_t he_fallback_address;
+        static const uint32_t *he_fallback_addresses[] =
+            { &he_fallback_address, NULL };
 #else
-        in_addr_t he_fallback_address = INADDR_ANY;
-        in_addr_t *he_fallback_addresses[] = { &he_fallback_address, NULL };
+        static in_addr_t he_fallback_address;
+        static const in_addr_t *he_fallback_addresses[] =
+            { &he_fallback_address, NULL };
 #endif
-        struct hostent he_fallback = { NULL, NULL, AF_INET,
-                                       sizeof(he_fallback_address),
-                                       (char **)&he_fallback_addresses };
+        static const struct hostent he_fallback =
+            { NULL, NULL, AF_INET, sizeof(he_fallback_address),
+              (char **)&he_fallback_addresses };
         struct servent *se;
         /* Apprently, on WIN64, s_proto and s_port have traded places... */
 #ifdef _WIN64
@@ -695,6 +697,7 @@ int BIO_lookup(const char *host, const char *service,
 
         CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME);
         CRYPTO_w_lock(CRYPTO_LOCK_GETSERVBYNAME);
+        he_fallback_address = INADDR_ANY;
         if (host == NULL) {
             he = &he_fallback;
             switch(lookup_type) {


More information about the openssl-commits mailing list