]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: check that the multi handle is valid in curl_multi_assign
authorDaniel Stenberg <daniel@haxx.se>
Wed, 11 Sep 2024 12:12:41 +0000 (14:12 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 11 Sep 2024 21:04:11 +0000 (23:04 +0200)
By requiring that the multi handle is fine, it can detect bad usage
better and by that avoid crashes. Like in the #14860 case, which is an
application calling curl_multi_assign() with a NULL pointer multi
handle.

Reported-by: Carlo Cabrera
Fixes #14860
Closes #14862

lib/multi.c

index 062d09cc0bf5bd3381ea802ef573effae5eda63a..78e5c0a1e574a569df06e45c7739971d0a922a4e 100644 (file)
@@ -3688,6 +3688,8 @@ CURLMcode curl_multi_assign(struct Curl_multi *multi, curl_socket_t s,
                             void *hashp)
 {
   struct Curl_sh_entry *there = NULL;
+  if(!GOOD_MULTI_HANDLE(multi))
+    return CURLM_BAD_HANDLE;
 
   there = sh_getentry(&multi->sockhash, s);