[PATCH] hostip: include easy_lock.h before using GLOBAL_INIT_IS_THREADSAFE
authorDaniel Stenberg <daniel@haxx.se>
Tue, 16 May 2023 21:40:42 +0000 (23:40 +0200)
committerSamuel Henrique <samueloph@debian.org>
Thu, 18 May 2023 22:43:40 +0000 (23:43 +0100)
Since that header file is the only place that define can be defined.

Reported-by: Marc Deslauriers
Follow-up to 13718030ad4b3209

Closes #11121

Gbp-Pq: Name CVE-2023-28320-1.patch

lib/hostip.c
lib/hostip.h

index 77f0ecef2e2b88aafb5877fbe79e8472f8b8fe78..fd289eadf8e0a46dacfe0547b46c918f72aed202 100644 (file)
@@ -70,6 +70,8 @@
 #include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
 #endif
 
+#include "easy_lock.h"
+
 #if defined(CURLRES_SYNCH) &&                   \
   defined(HAVE_ALARM) &&                        \
   defined(SIGALRM) &&                           \
 #define USE_ALARM_TIMEOUT
 #endif
 
-#ifdef USE_ALARM_TIMEOUT
-#include "easy_lock.h"
-#endif
-
 #define MAX_HOSTCACHE_LEN (255 + 7) /* max FQDN + colon + port number + zero */
 
 /*
@@ -258,8 +256,8 @@ void Curl_hostcache_prune(struct Curl_easy *data)
 /* Beware this is a global and unique instance. This is used to store the
    return address that we can jump back to from inside a signal handler. This
    is not thread-safe stuff. */
-sigjmp_buf curl_jmpenv;
-curl_simple_lock curl_jmpenv_lock;
+static sigjmp_buf curl_jmpenv;
+static curl_simple_lock curl_jmpenv_lock;
 #endif
 
 /* lookup address, returns entry if found and not stale */
index e0d13cd4021106bda206bbb171f30678d962c025..d709d8ba4eba20f857aa04f17d4a4c3bf8234dcc 100644 (file)
@@ -186,15 +186,6 @@ Curl_cache_addr(struct Curl_easy *data, struct Curl_addrinfo *addr,
 #define CURL_INADDR_NONE INADDR_NONE
 #endif
 
-#ifdef HAVE_SIGSETJMP
-/* Forward-declaration of variable defined in hostip.c. Beware this
- * is a global and unique instance. This is used to store the return
- * address that we can jump back to from inside a signal handler.
- * This is not thread-safe stuff.
- */
-extern sigjmp_buf curl_jmpenv;
-#endif
-
 /*
  * Function provided by the resolver backend to set DNS servers to use.
  */