multi.h: add CURLMNWC_CLEAR_ALL

The two bitmask constants for *CLEAR_DNS and *CLEAR_CONNS were
duplicates (both set to 1), so they cannot be distinguished and both
actions fire.

This shipped in public releases since 8.16.0 to and include 8.19.0.

This fix adds CURLMNWC_CLEAR_ALL to be the new 1, and it now implies all
bits. The DNS and CONNS defines get two new bits (2, 4).

Follow-up to 55c045c863

Found by Codex Security
Closes #20968
This commit is contained in:
Daniel Stenberg 2026-03-21 23:06:02 +01:00
parent e9eddedf38
commit 57a94fec47
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 36 additions and 23 deletions

View file

@ -3328,6 +3328,11 @@ CURLMcode curl_multi_setopt(CURLM *m, CURLMoption option, ...)
}
case CURLMOPT_NETWORK_CHANGED: {
long val = va_arg(param, long);
if(val & CURLMNWC_CLEAR_ALL)
/* In the beginning, all values available to set were 1 by mistake. We
converted this to mean "all", thus setting all the bits
automatically */
val = CURLMNWC_CLEAR_DNS | CURLMNWC_CLEAR_CONNS;
if(val & CURLMNWC_CLEAR_DNS) {
Curl_dnscache_clear(multi->admin);
}