]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 months agodnscache: own source file, improvements
Stefan Eissing [Fri, 6 Mar 2026 08:22:26 +0000 (09:22 +0100)] 
dnscache: own source file, improvements

- Rename `Curl_resolv_unlink()` to `Curl_dns_entry_unlink()`.
- Change `Curl_dnscache_get()` to return CURLcode result. Returns
  now `CURLE_COULDNT_RESOLVE_HOST` for "negative" cache entries.
- Add `Curl_dnscache_add_negative()` to put a "negative" entry
  into the cache.

Closes #20864

2 months agoopenssl channel_binding: lookup digest algorithm without NID
Stefan Eissing [Thu, 26 Feb 2026 09:21:31 +0000 (10:21 +0100)] 
openssl channel_binding: lookup digest algorithm without NID

Use an alternate OpenSSL API to get the digest algorithm tied
to a certificate signature to compute the channel binding.

Fixes #20590
Reported-by: Rob Crittenden
Closes #20734

2 months agomulti: improve wakeup and wait code
Stefan Eissing [Fri, 6 Mar 2026 09:10:55 +0000 (10:10 +0100)] 
multi: improve wakeup and wait code

- Split WINSOCK and POSIX code in `multi_wait()` as the ifdef'ery
  was becoming unreadable
- define `ENABLE_WAKEUP` to mean the wakeup socketpair is enabled,
  no additional USE_WINSOCK check needed. Under WINSOCK
  `ENABLE_WAKEUP` is not defined, so it's availability is as before
  under the double defined() checks
- When the multi handle has "alive" transfers, the admin handle's
  pollset include the wakeup receive socket. This results in the
  admin handle running when someone uses `curl_multi_wakeup()`.
- Without any "alive" transfers, the wakeup socket is removed from
  the pollset. Otherwise, event based processing would never finish,
  eg. leave the event loop.
- The wakeup socket was never registered for event processing before,
  e.g. `curl_multi_wakeup()` never worked in that mode.
- Adjust test exepectations on socket callback invocations and
  number of sockets appearing in waitfds sets.

Closes #20832

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 20 Mar 2026 21:28:50 +0000 (22:28 +0100)] 
RELEASE-NOTES: synced

Bump curlver to 8.20.0 for pending release

2 months agoGHA/windows: disable `taskkill` in torture jobs
Viktor Szakats [Fri, 20 Mar 2026 18:00:44 +0000 (19:00 +0100)] 
GHA/windows: disable `taskkill` in torture jobs

As an experiment.

Also:
- processhelp.pm: log when `taskkill` is force-skipped.

Ref: #21035

Follow-up to f450f3801b6b9dff0ea280f5fb4bf28203f7b313 #19897
Follow-up to 2701ac6a4d16a62130dad05be1c484903b8545c7 #19421

Closes #21039

2 months agowolfssl: fix handling of abrupt connection close
Stefan Eissing [Thu, 19 Mar 2026 09:33:08 +0000 (10:33 +0100)] 
wolfssl: fix handling of abrupt connection close

A closed connection without TLS notify shutdowns, has been reported as a
correct EOF instead of an error. Fix the error handling in wolfSSL
backend receive handling.

Spotted by Codex Security

Closes #21002

2 months agotransfer: enable custom methods again on next transfer
Daniel Stenberg [Fri, 20 Mar 2026 16:28:03 +0000 (17:28 +0100)] 
transfer: enable custom methods again on next transfer

`http_ignorecustom` is set on redirect handling but was not reset
between transfers, so once a redirect occurs in the new follow modes,
custom request methods were ignored for later transfers on the same
handle.

Follow-up to fb13923dd67d5196c47e8d

Detected by Codex Security

Closes #21037

2 months agoprotcol.h: fix the CURLPROTO_MASK
Daniel Stenberg [Fri, 20 Mar 2026 12:55:47 +0000 (13:55 +0100)] 
protcol.h: fix the CURLPROTO_MASK

It had an 'f' too few. Also provide CURLPROTO_WS* unconditionally
internally, so that code can depend on them in all builds.

Follow-up to cd5ca80f00d2d9f0fe7

Spotted by Codex Security

Test case 3219 added to catch this next time.

Closes #21031

2 months agotool_operhlp: fix `add_file_name_to_url()` result on OOM
Viktor Szakats [Thu, 19 Mar 2026 14:47:05 +0000 (15:47 +0100)] 
tool_operhlp: fix `add_file_name_to_url()` result on OOM

Return `CURLE_OUT_OF_MEMORY` instead of `CURLE_URL_MALFORMAT` when
`curl_url()`, `curl_easy_escape()`, or `curl_maprintf()` calls failed.

Found by Codex Security

Also reuse deinit code from a success branch.

Closes #21011

2 months agourldata: make speeder_c uint32
Daniel Stenberg [Fri, 20 Mar 2026 14:55:33 +0000 (15:55 +0100)] 
urldata: make speeder_c uint32

This counter is meant to virtually never wrap.

Follow-up to e3691612ea1

Spotted by Codex Security

Closes #21036

2 months agounit1627.c: remove a newline
Daniel Stenberg [Fri, 20 Mar 2026 15:55:19 +0000 (16:55 +0100)] 
unit1627.c: remove a newline

2 months agoprotocol: use scheme names lowercase
Daniel Stenberg [Fri, 20 Mar 2026 13:28:51 +0000 (14:28 +0100)] 
protocol: use scheme names lowercase

When composing the <scheme>_proxy environment variable, we assume the
handler->scheme name is already lowercase.

This makes unit test 1627 verify that is the case.

Follow-up to c294f9cb564a2d550826cd5

Spotted by Codex Security

Closes #21033

2 months agofile: init fd to -1 to prevent close fd 0 on early failure
Daniel Stenberg [Fri, 20 Mar 2026 12:39:02 +0000 (13:39 +0100)] 
file: init fd to -1 to prevent close fd 0 on early failure

Spotted by Codex Security

Closes #21029

2 months agogetinfo: initialize `PureInfo` field `used_proxy`
Viktor Szakats [Fri, 20 Mar 2026 00:56:09 +0000 (01:56 +0100)] 
getinfo: initialize `PureInfo` field `used_proxy`

Found by Codex Security

Follow-up to cc04c7367740bb6db0e47368247b8b0c70c376cb #12719

Closes #21020

2 months agourl: use the socks type for socks proxy
Daniel Stenberg [Fri, 20 Mar 2026 10:06:47 +0000 (11:06 +0100)] 
url: use the socks type for socks proxy

Reported by Codex Security

Closes #21025

2 months agox509asn1: fixed and adapted for ASN1tostr unit testing
Daniel Stenberg [Thu, 19 Mar 2026 15:51:07 +0000 (16:51 +0100)] 
x509asn1: fixed and adapted for ASN1tostr unit testing

- move defines to header file
- make bit2str require < 8 unused bits
- make bool strings stricter
- make UTime2str show + or - for custom time zones
- removed unused 'type' argument to ASN1tostr() function
- fix int2str for negative values. All values below 10000 are now shown
  in decimal properly, also possibly negative values.

Add unit test 1667 to verify ASN1tostr

Closes #21013

2 months agotool_operate: drop the scheme-guessing in the -G handling
Daniel Stenberg [Wed, 18 Mar 2026 23:12:33 +0000 (00:12 +0100)] 
tool_operate: drop the scheme-guessing in the -G handling

Prior to this, -G would override the scheme set with --proto-default and
revert back to guessing the scheme based on the hostname.

Add test 2008 to verify the fix

Spotted by Codex Security

Closes #20992

2 months agobuild: limit `unitprotos.h` include to `units` target
Viktor Szakats [Fri, 20 Mar 2026 09:58:44 +0000 (10:58 +0100)] 
build: limit `unitprotos.h` include to `units` target

To omit it from `tunits`.

Also: move the include to `unitcheck.h` to save a guard.

Ref: https://github.com/curl/curl/pull/21014#issuecomment-4093742896
Reported-by: Daniel Stenberg
Fixes #21021
Follow-up to 98d8e82c7471232639841eb63e16bb979a30acb4 #21014

Closes #21024

2 months agotests/unit/README: describe how to unit test static functions 21018/head
Daniel Stenberg [Thu, 19 Mar 2026 22:05:05 +0000 (23:05 +0100)] 
tests/unit/README: describe how to unit test static functions

UNITTEST explained

Closes #21018

2 months agolib: move all UNITTEST prototypes to C files
Daniel Stenberg [Thu, 19 Mar 2026 16:04:00 +0000 (17:04 +0100)] 
lib: move all UNITTEST prototypes to C files

- make extract-unit-protos handle multi-line prototypes - but they need
  to be above the implementation

- Prototypes for static functions we use in unit tests should not be in
  header files. We generate lib/unitprotos.h for this purpose

- Removed some function wrappers written for unit tests and make them
  use UNITTEST function directly.

- Renamed time2str() in the tool to timebuf() since we have the same
  name in lib/ and in unit tests they can both be used non-static in a
  build.

This reverts commit f95fadd116d54f9031e3ba081e09e5a4f3aa7209.

Follow-up to #21010

Closes #21014

2 months agoGHA/macos: restore compatibility with Intel runners
Viktor Szakats [Thu, 19 Mar 2026 23:16:37 +0000 (00:16 +0100)] 
GHA/macos: restore compatibility with Intel runners

By generalizing Homebrew prefix in shared code paths, where missing.
No strong reason, sometimes it's useful for tests.

Follow-up to e5316069f13ec9189d9fe0499dc09afaa9fb5cee #18818

Closes #21019

2 months agomk-lib1521.pl: fix 4 callback function types passed to setopt
Viktor Szakats [Thu, 19 Mar 2026 21:43:56 +0000 (22:43 +0100)] 
mk-lib1521.pl: fix 4 callback function types passed to setopt

Silencing these warnings (seen on Solaris 11 SPARC GCC 4.9.2 + OpenCSW):
```
lib1521.c: In function 'test_lib1521':
/include/curl/typecheck-gcc.h:93:13: warning: call to 'Wcurl_easy_setopt_err_conv_cb' declared with attribute warning: curl_easy_setopt expects a curl_conv_callback argument
curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION,
curl_easy_setopt(curl, CURLOPT_CONV_TO_NETWORK_FUNCTION,
curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION,
/include/curl/typecheck-gcc.h:123:13: warning: call to 'Wcurl_easy_setopt_err_interleave_cb' declared with attribute warning: curl_easy_setopt expects a curl_interleave_callback argument
curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION,
```
Ref: https://curl.se/dev/log.cgi?id=20260319160651-1785427#prob2

Follow-up to de0adda78c4c3ce6d221beefdcd4492412dcf287

Closes #21017

2 months agoservers.pm: fix to check gopher6 server on its ipv6 port
Viktor Szakats [Thu, 19 Mar 2026 19:54:43 +0000 (20:54 +0100)] 
servers.pm: fix to check gopher6 server on its ipv6 port

Found by Codex Security

Closes #21016

2 months agocmake: extend C89-specific warning suppressions to all llvm/clang
Viktor Szakats [Thu, 19 Mar 2026 16:28:12 +0000 (17:28 +0100)] 
cmake: extend C89-specific warning suppressions to all llvm/clang

From Apple clang-only prior to this patch.

Silencing (seen after macos-15 runner accidentally switched to
llvm/clang by default):
```
/Users/runner/work/curl/curl/lib/curlx/warnless.h:64:1: error: '_Bool' is a C99 extension [-Werror,-Wc99-extensions]
   64 | bool curlx_sztouz(ssize_t sznum, size_t *puznum);
      | ^
/opt/homebrew/Cellar/llvm@18/18.1.8/lib/clang/18/include/stdbool.h:20:14: note: expanded from macro 'bool'
   20 | #define bool _Bool
      |              ^
[...]
```
Ref: https://github.com/curl/curl/actions/runs/23304345180/job/67774031335?pr=21014#step:11:39

Follow-up to 09c9afdd711d0b2ee9f524a235803e755e1074b7 #20363
Ref: https://github.com/actions/runner-images/issues/13827

Closes #21015

2 months agooptiontable: replace stdin with filename arg, harden `open()` call
Viktor Szakats [Thu, 19 Mar 2026 13:33:47 +0000 (14:33 +0100)] 
optiontable: replace stdin with filename arg, harden `open()` call

Closes #21008

2 months agox509asn1: move declaration to header
Viktor Szakats [Thu, 19 Mar 2026 13:47:12 +0000 (14:47 +0100)] 
x509asn1: move declaration to header

Fixing clang-tidy warning:
```
tests/unit/unit1666.c:50:12: error: call to undeclared function 'encodeOID'; ISO C99 and later do not support implicit function declarations [clang-diagnostic-implicit-function-declaration]
   50 |   result = encodeOID(dbuf, oid, oid + spec->size);
      |            ^
```
Ref: https://github.com/curl/curl/actions/runs/23297585235/job/67749144361?pr=21008#step:46:736

Follow-up to 673e14cd33ef720b8c2b7e3485084e6e41a2c9dd #21003

Closes #21010

2 months agoscripts: harden / tidy up more Perl `system()` calls
Viktor Szakats [Thu, 19 Mar 2026 11:19:04 +0000 (12:19 +0100)] 
scripts: harden / tidy up more Perl `system()` calls

Closes #21007

2 months agodocs: enable more compiler warnings for C snippets, fix 3 finds
Viktor Szakats [Thu, 19 Mar 2026 11:34:32 +0000 (12:34 +0100)] 
docs: enable more compiler warnings for C snippets, fix 3 finds

Also:
- sync gcc option order.
- unfold lines in C snippet.

Closes #21006

2 months agox509asn1: improve encodeOID
Daniel Stenberg [Thu, 19 Mar 2026 08:55:46 +0000 (09:55 +0100)] 
x509asn1: improve encodeOID

- return error on zero length input
- return error on OOM or doing too large output
- fix full 32-bit number support
- fix the broken handling of the first and second numbers
- support up to 32-bit minus 80 for the second number
- a field with a leading 0x80 is now considered an error, since it only
  works as padding and is then no longer the shortest possible version

Add unit tests in 1666

Bonus: removed the last argument to OID2str() as it was always set TRUE.

Closes #21003

2 months agoinclude: drop 'will' from public headers
Viktor Szakats [Thu, 19 Mar 2026 01:59:42 +0000 (02:59 +0100)] 
include: drop 'will' from public headers

Closes #21005

2 months agoextract-unit-protos: retain internal paths for includes
Viktor Szakats [Thu, 19 Mar 2026 10:42:29 +0000 (11:42 +0100)] 
extract-unit-protos: retain internal paths for includes

Follow-up to 3058ed3df873c21ebba2007c3b12ed9f37558bfe #20623

Closes #21004

2 months agoexamples: fix typo in comment
Jason Stangroome [Thu, 19 Mar 2026 02:34:02 +0000 (13:34 +1100)] 
examples: fix typo in comment

noticed while reviewing https://github.com/curl/curl/pull/20793

Ref: https://github.com/curl/curl/pull/20793/changes#r2957089487

Closes #21001

2 months agoGHA: update dependency wolfSSL/wolfssl to v5.9.0
renovate[bot] [Thu, 19 Mar 2026 01:06:02 +0000 (01:06 +0000)] 
GHA: update dependency wolfSSL/wolfssl to v5.9.0

Closes #20998

2 months agomod_curltest: fix allocation size
Viktor Szakats [Wed, 18 Mar 2026 23:53:00 +0000 (00:53 +0100)] 
mod_curltest: fix allocation size

It wasn't causing an issue with current usage.

Found by Codex Security

Follow-up to 35cfb081d24ae4c1608601f71890e43907643ae5 #16541

Closes #20994

2 months agoopenssl: fix memory leaks in ECH code (OpenSSL 3)
Viktor Szakats [Wed, 18 Mar 2026 23:37:14 +0000 (00:37 +0100)] 
openssl: fix memory leaks in ECH code (OpenSSL 3)

Also drop an unnecessary cast.

Found by Codex Security

Follow-up to a362962b7289ec02b412890c9515657cf0ed50ac #11922

Closes #20993

2 months agotool_operate: fix condition for loading `curl-ca-bundle.crt` (Windows)
Viktor Szakats [Wed, 18 Mar 2026 19:27:24 +0000 (20:27 +0100)] 
tool_operate: fix condition for loading `curl-ca-bundle.crt` (Windows)

It was incorrecly loaded with env `CURL_CA_BUNDLE` unset +
`SSL_CERT_DIR` set + `SSL_CERT_FILE` unset.

Found by Codex Security

Follow-up to 29bce9857a12b6cfa726a506ab99c4c4c7969364 #11325 #11531

Closes #20989

2 months agosws: fix potential OOB write
Viktor Szakats [Wed, 18 Mar 2026 18:28:03 +0000 (19:28 +0100)] 
sws: fix potential OOB write

Found by Codex Security

Follow-up to 0aaebf62ec281286afb9e51f2a8088302463df3f

Closes #20988

2 months agosshserver.pl: harden more `system()` calls
Viktor Szakats [Thu, 19 Mar 2026 00:56:46 +0000 (01:56 +0100)] 
sshserver.pl: harden more `system()` calls

Ref: https://perldoc.perl.org/functions/system

Closes #20997

2 months agosshserver.pl: pass command-line to `system()` safely
Viktor Szakats [Thu, 19 Mar 2026 00:22:37 +0000 (01:22 +0100)] 
sshserver.pl: pass command-line to `system()` safely

Found by Codex Security

Follow-up to 89f306ae40b678bd91595ba41fe5f9d5ed374897 #16781

Closes #20996

2 months agox509asn1: fix to return error in an error case from `encodeOID()`
Viktor Szakats [Wed, 18 Mar 2026 23:11:33 +0000 (00:11 +0100)] 
x509asn1: fix to return error in an error case from `encodeOID()`

Found by Codex Security

Follow-up to d8b0318ad6da7e51f7c94df00a5f165a52580889 #3582

Closes #20991

2 months agobuild: enable `-Wimplicit-int-enum-cast` compiler warning, fix issues
Viktor Szakats [Wed, 18 Mar 2026 23:02:02 +0000 (00:02 +0100)] 
build: enable `-Wimplicit-int-enum-cast` compiler warning, fix issues

Offered by clang 21+.

Closes #20990

2 months agosynctime: fix off-by-one read and write to a read-only buffer (Windows)
Viktor Szakats [Wed, 18 Mar 2026 18:01:10 +0000 (19:01 +0100)] 
synctime: fix off-by-one read and write to a read-only buffer (Windows)

Also making the `--synctime` option work.

Off-by-one found by Codex Security

Assisted-by: Jay Satiro
Closes #20987

2 months agoasyn-ares: drop orphaned variable references
Viktor Szakats [Thu, 19 Mar 2026 01:07:21 +0000 (02:07 +0100)] 
asyn-ares: drop orphaned variable references

In rare, conditional `#if` branches.

Found by Codex Security

Follow-up to ac7e2c3dc693b43c61898aea89f1a80037505c36 #17450
Follow-up to 7bf576064c21fe0bb03a67c382d692ebbb9e3426 #17167

Closes #20999

2 months agoGHA: update dependency nghttp2/nghttp2 to v1.68.1
renovate[bot] [Wed, 18 Mar 2026 12:08:00 +0000 (12:08 +0000)] 
GHA: update dependency nghttp2/nghttp2 to v1.68.1

Closes #20982

2 months agorand: use `BCryptGenRandom()` in UWP builds
Viktor Szakats [Wed, 18 Mar 2026 13:13:07 +0000 (14:13 +0100)] 
rand: use `BCryptGenRandom()` in UWP builds

Also:
- fix build configuration to correctly set Win10 target in the mingw-w64
  CI build, to enable the `BCryptGenRandom()` prototype in v6+ SDK
  headers.

Ref: https://learn.microsoft.com/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom

Issue raised by Codex Security

Closes #20983

2 months agolib: always use Curl_1st_fatal instead of Curl_1st_err
Stefan Eissing [Wed, 18 Mar 2026 10:37:18 +0000 (11:37 +0100)] 
lib: always use Curl_1st_fatal instead of Curl_1st_err

Curl_1st_err() does not return the second error if the first result is
CURLE_AGAIN. This may cause errors to not become noticeable when they
should be.

Replace all use of Curl_1st_err() with Curl_1st_fatal(), which handles
CURLE_AGAIN as a not-a-real-error case.

Closes #20980

2 months agoscripts: drop unused CI scripts
Viktor Szakats [Wed, 18 Mar 2026 11:03:04 +0000 (12:03 +0100)] 
scripts: drop unused CI scripts

Replaced by Test Clutch:
https://testclutch.curl.se/static/reports/feature-matrix.html

Closes #20981

2 months agobadwords: prefer 'null-terminated'
Viktor Szakats [Wed, 18 Mar 2026 10:29:53 +0000 (11:29 +0100)] 
badwords: prefer 'null-terminated'

Aligning with existing text.

Closes #20979

2 months agoexamples/websocket: fix to sleep more on Windows
Viktor Szakats [Wed, 18 Mar 2026 10:12:04 +0000 (11:12 +0100)] 
examples/websocket: fix to sleep more on Windows

Found by Codex Security

Follow-up to d4b85890555388bec212b75f47a5c1a48705b156 #13771

Closes #20978

2 months agodelta: avoid potential zero division
Viktor Szakats [Wed, 18 Mar 2026 09:54:27 +0000 (10:54 +0100)] 
delta: avoid potential zero division

Found by Codex Security

Closes #20977

2 months agogcc: guard `#pragma diagnostic` in core code for <4.6, disable picky warnings
Viktor Szakats [Thu, 12 Mar 2026 09:58:35 +0000 (10:58 +0100)] 
gcc: guard `#pragma diagnostic` in core code for <4.6, disable picky warnings

Extend `#pragma diagnostic push`/`pop` guards to the whole codebase
(from tests and examples only) to disable it for GCC <4.6. Rename guard
to `CURL_HAVE_DIAG` and make it include llvm/clang to be interchangeable
with `__GNUC__ || __clang__` in this context.

The above means no longer disabling certain warnings locally, so pair
this with disabling all picky warnings for GCC <4.6.

Also:
- drop global workarounds for misbehaving GCC <4.6 compiler warnings.
  Not needed with picky warnings disabled.

Reported-by: fds242 on github
Reported-by: Sergey Fedorov
Thanks-to: Orgad Shaneh
Follow-up to f07a98ae113b832a8748ba66e1554a7f14c6897e #20366
Fixes #20892
Fixes #20924
Closes #20902
Closes #20907

2 months agoftp: reject PWD responses containing control characters
Ercan Ermis [Tue, 17 Mar 2026 08:47:24 +0000 (09:47 +0100)] 
ftp: reject PWD responses containing control characters

A malicious or compromised FTP server could include control characters
(e.g. bare \r, or bytes 0x01-0x1f/0x7f) inside the quoted directory path
of its 257 PWD response. That string is stored verbatim as
ftpc->entrypath and later sent unescaped in a CWD command on connection
reuse via Curl_pp_sendf(), which performs no sanitization before
appending \r\n.

Reject the entire path if any control character is encountered during
extraction so that tainted data never reaches a subsequent FTP command.

Add test case 3217 and 3218 to verify. Adjusted test 1152 accordingly.

Closes #20949

2 months agobadwords: pass config as filename arg
Viktor Szakats [Tue, 17 Mar 2026 23:51:08 +0000 (00:51 +0100)] 
badwords: pass config as filename arg

Instead of stdin.

To simplify the command-line, and allow using a safe and portable
`system()` call from `badwords-all`.

Ref: https://perldoc.perl.org/functions/system

Closes #20970

2 months agourlapi: make dedotdotify handle leading dots correctly
Daniel Stenberg [Wed, 18 Mar 2026 08:14:59 +0000 (09:14 +0100)] 
urlapi: make dedotdotify handle leading dots correctly

Paths starting with one or two leading dots but without a following
slash were not handled correctly.

Follow-up to c31dd6631f9a0177aa9045cdbb

Extended test 1395 accordingly with a set of new test string.

Reported by Codex Security

Closes #20974

2 months agotool_msgs: avoid null pointer deref for early errors
Daniel Stenberg [Tue, 17 Mar 2026 23:00:52 +0000 (00:00 +0100)] 
tool_msgs: avoid null pointer deref for early errors

When errorf()/warnf() is used early on, before the global pointer is
setup, curl would previosly deref the null pointer.

Follow-up to 3b40128b0f11a3

Found by Codex Security

Closes #20967

2 months agohttp2: clear the h2 session at delete
Daniel Stenberg [Wed, 18 Mar 2026 09:12:46 +0000 (10:12 +0100)] 
http2: clear the h2 session at delete

When calling nghttp2 to delete session, clear the pointer to avoid risk
of UAF.

Pointed out by Codex Security

Closes #20975

2 months agoasyn-ares: fix HTTPS-lookup when not on port 443
Daniel Stenberg [Tue, 17 Mar 2026 22:53:33 +0000 (23:53 +0100)] 
asyn-ares: fix HTTPS-lookup when not on port 443

Follow-up to 8d0bfe74fba1e8394e73d

Spotted by Codex Security

Closes #20966

2 months agotop-complexity: prevent filename-based shell injection risk
Daniel Stenberg [Tue, 17 Mar 2026 23:14:35 +0000 (00:14 +0100)] 
top-complexity: prevent filename-based shell injection risk

As we run this script in CI, this should reduce the risk of mischief

Found by Codex Security

Closes #20969

2 months agotool_formparse: propagate my_get_line errors when reading headers
Daniel Stenberg [Tue, 17 Mar 2026 15:22:54 +0000 (16:22 +0100)] 
tool_formparse: propagate my_get_line errors when reading headers

The read_field_headers() function would return "ok" even if the
underlying file read returned error, thus would the parent not become
aware of the problem.

Follow-up to f847d2ed0244319ee6b5e9b054c

Found by Codex Security

Closes #20963

2 months agogenerate.bat: remove extra % from VC11 and VC12 runs
Daniel Stenberg [Tue, 17 Mar 2026 15:46:02 +0000 (16:46 +0100)] 
generate.bat: remove extra % from VC11 and VC12 runs

The extra % translates to nothing, so this did not break anything they
are just superfluous.

Follow-up to 57d349fe0eee7e1f3eb68dc

Assisted-by: Viktor Szakats
Found by Codex Security

2 months agocmake: document functions used from Windows system DLLs
Viktor Szakats [Tue, 17 Mar 2026 19:20:13 +0000 (20:20 +0100)] 
cmake: document functions used from Windows system DLLs

Closes #20965

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 17 Mar 2026 16:05:15 +0000 (17:05 +0100)] 
RELEASE-NOTES: synced

2 months agonetrc: refactor into smaller sub functions
Daniel Stenberg [Mon, 9 Mar 2026 07:38:14 +0000 (08:38 +0100)] 
netrc: refactor into smaller sub functions

Fixes #20950 - test 685 is extended for this
Closes #20932

2 months agoimap: reset the UIDVALIDITY state between transfers
Daniel Stenberg [Tue, 17 Mar 2026 15:18:03 +0000 (16:18 +0100)] 
imap: reset the UIDVALIDITY state between transfers

uidvalidity_set and mb_uidvalidity_set flags were never reset, leaving a
risk for stale UIDVALIDITY state across transfers and mailbox switches.

Follow-up to fb6a4802d7a76d8e36652b

Spotted by Codex Security

Closes #20962

2 months agocurl_get_line: error out on read errors
Daniel Stenberg [Tue, 17 Mar 2026 12:55:21 +0000 (13:55 +0100)] 
curl_get_line: error out on read errors

Missing ferror handling in Curl_get_line causes infinite loops on I/O
errors, leading to denial-of-service hangs for config/cache file loads.

Follow-up to 769ccb4d4261a75c8a4

Pointed out by Codex Security

Closes #20958

2 months agotransfer: enhance secure check
Stefan Eissing [Tue, 17 Mar 2026 10:40:13 +0000 (11:40 +0100)] 
transfer: enhance secure check

Introduce `Curl_xfer_is_secure(data)` that returns TRUE for transfers
that happen(ed) over a end-to-end secured connection, e.g. SSL.

Add test1586 to verify behaviour for http: transfers via a https: proxy.

Reported-by: lg_oled77c5pua on hackerone
Closes #20951

2 months agotool_ipfs: accept IPFS gateway URL without set port number
Daniel Stenberg [Tue, 17 Mar 2026 12:39:28 +0000 (13:39 +0100)] 
tool_ipfs: accept IPFS gateway URL without set port number

Follow-up to: 56129718b80b5bd5a55

Test 1851 added to verify

Pointed out by Codex Security

Closes #20957

2 months agourldata: remove trailers_state
Stefan Eissing [Tue, 17 Mar 2026 13:18:45 +0000 (14:18 +0100)] 
urldata: remove trailers_state

It's not used anywhere. Remove `data->state.trailers_state` completely.

Closes #20960

2 months agoconnection bits: move 'connect_only' here
Stefan Eissing [Tue, 17 Mar 2026 12:57:42 +0000 (13:57 +0100)] 
connection bits: move 'connect_only' here

Move the bit `connection_only` from `connectdata` to `ConnectBits`.
Since we keep all other bits there, seems the correct place.

Closes #20959

2 months agotool_urlglob: fix memory-leak on glob range overflow
Daniel Stenberg [Tue, 17 Mar 2026 12:30:02 +0000 (13:30 +0100)] 
tool_urlglob: fix memory-leak on glob range overflow

Follow-up to 5f273fdddf76544de960b

Pointed out by Codex Security

Closes #20956

2 months agopytest: add additional quiche check for flaky test_05_01
Stefan Eissing [Tue, 17 Mar 2026 11:38:30 +0000 (12:38 +0100)] 
pytest: add additional quiche check for flaky test_05_01

As long as stream resets are not visible in the API reliably,
exclude test_05_01, same as test_05_02 already.

Closes #20952

2 months agotool_operate: fix minor memory-leak on early error
Daniel Stenberg [Tue, 17 Mar 2026 12:19:25 +0000 (13:19 +0100)] 
tool_operate: fix minor memory-leak on early error

When .curlrc is parsed successfully but the tool exits early before
parse_args() executes; the allocated path was not freed.

Spotted by Codex Security

Closes #20954

2 months agoDockerfile: update debian:bookworm-slim Docker digest to f065376
renovate[bot] [Mon, 16 Mar 2026 23:43:29 +0000 (23:43 +0000)] 
Dockerfile: update debian:bookworm-slim Docker digest to f065376

Closes #20946

2 months agostrerr: correct the strerror_s() return code condition
Daniel Stenberg [Tue, 17 Mar 2026 12:23:30 +0000 (13:23 +0100)] 
strerr: correct the strerror_s() return code condition

In curlx_strerror on Windows, the condition checks `!strerror_s(...)`
(true on success) and therefore always evaluates the fallback block.
Even when strerror_s successfully produced a valid errno message.

Follow-up to 1eca08a54177403205014

Pointed out by Codex Security
Closes #20955

2 months agoconfigure: fix `--with-ngtcp2=<path>` option for crypto libs
Viktor Szakats [Fri, 13 Mar 2026 15:34:57 +0000 (16:34 +0100)] 
configure: fix `--with-ngtcp2=<path>` option for crypto libs

ngtcp2 1.14.0 added module dependencies to `ngtcp2_crypto_*.pc` files.
This broke certain build cases in curl, because configure was is
querying pkg-config modules by setting `PKG_CONFIG_LIBDIR` to the
directory specified via `--with-*=` options, including `--with-ngtcp2=`.
Setting `PKG_CONFIG_LIBDIR` tells pkg-config (and pkgconf) to ignore
system locations. This caused that `ngtcp2_crypto_gnutls.pc` could no
longer find its indirect dependencies, if those were present at system
locations (where they typically are). Another fallout was BoringSSL,
because it does not provide `openssl.pc` on its own, and successful
detection relied on finding a non-BoringSSL copy, typically at a system
location (also fixed in ngtcp2 main branch).

Fix `ngtcp2_crypto_*` detections to not touch `PKG_CONFIG_LIBDIR` and
instead prepend `<path>` set via `--with-ngtcp2=` to `PKG_CONFIG_PATH`.
This ensures to pick up any dependent modules from system locations.

Note the side-effect is that potentially undesired modules may be
detected this way from system locations, i.e. it makes this particular
detection less "hermetic" than the rest used in curl configure.

(Configurations using a bare `--with-ngtcp2` with no path were not
affected, and served as a workaround before this patch. It remains a
valid way of configuration after.)

Both `pkgconf` and `pkg-config` use this logic to calculate their search
directory list:
```pseudo
search = {}
if PKG_CONFIG_PATH is set
  search += PKG_CONFIG_PATH
endif
if PKG_CONFIG_LIBDIR is set (even if empty)
  search += PKG_CONFIG_LIBDIR
else
  search += built-in-pkg-config-dirs
endif
```

Refs:
https://github.com/curl/curl/pull/18028/commits (earlier attempt. Failed due to using `PKG_CONFIG_DIR` instead of the correct `PKG_CONFIG_PATH`)
https://github.com/curl/curl/pull/18028/commits/c0874ce8242d42a1ae1d570d6b70b8360da56482
https://man.archlinux.org/man/pkgconf.1.en
https://manpages.debian.org/unstable/pkgconf/pkgconf.1.en.html
https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html
https://github.com/ngtcp2/ngtcp2/commit/10e27fd63cc7dd87236ab15de4a02eca6801e234

Bug: https://github.com/curl/curl/pull/18022#issuecomment-3120587041
Bug: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3120593664
Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931
Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188
Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022

Closes #20920

2 months agoopenssl: drop obsolete SSLv2 logic
Viktor Szakats [Mon, 16 Mar 2026 22:55:54 +0000 (23:55 +0100)] 
openssl: drop obsolete SSLv2 logic

Closes #20945

2 months agocurl_ctype.h: fix spelling in a couple of locally used macros
Flavio Amieiro [Wed, 4 Mar 2026 02:37:49 +0000 (23:37 -0300)] 
curl_ctype.h: fix spelling in a couple of locally used macros

The `ISLOWHEXALHA` and `ISUPHEXALHA` macros were introduced in commit
f65f750 and seem to be only referenced locally by the `ISXDIGIT` macro.

Judging by the `ISALPHA` macro defined in the same file, it seems like
the intention was to spell them as `IS.*HEXALPHA`.

I noticed this while reading through the code and decided to open a PR,
even if it is only a tiny change, just because I was already looking at
it and it might be useful. If there is any reason not to merge this,
please do close the PR.

Closes #20810

2 months agoftp: do not strdup DATA hostname
Stefan Eissing [Tue, 17 Mar 2026 12:13:04 +0000 (13:13 +0100)] 
ftp: do not strdup DATA hostname

Since `newhost` is already allocated, we do not need to strdup()
it. Just assign and NULL the reference.

Closes #20953

2 months agoHTTP3.md: minor improvements
Viktor Szakats [Mon, 16 Mar 2026 19:00:44 +0000 (20:00 +0100)] 
HTTP3.md: minor improvements

- document building curl with CMake.

- mention all supported forks in the OpenSSL section. Delete dedicated
  quictls section.

- add TLS-backend pkgconfig dir to `PKG_CONFIG_PATH` for correctness.
  OpenSSL-based ones often work without this, by finding system
  `openssl.pc`. For GnuTLS and wolfSSL this has a lesser chance. Best to
  point to them explicitly. (configure may technically be able to do
  this automatically, but it isn't implemented.)

- use `--with-ngtcp2=<path>` again, where possible.
  GnuTLS is the exception, pending fix in #20910.
  Same for BoringSSL, but not documented in `HTTP3.md`.

- replace `<somewhereN>` with `/path/to/depname` for clarity.

- move `LDFLAGS` after `./configure` for curl, to match dep builds.

- move `--with-ngtcp2` next to the TLS-backend option.

Follow-up to 1e3c2bec7eb735736755e15a48701f5b2d5b5979 #20926
Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188
Cherry-picked from #20920

Closes #20947

2 months agourl: don't assume all transfers have hostnames
Daniel Stenberg [Tue, 17 Mar 2026 08:35:31 +0000 (09:35 +0100)] 
url: don't assume all transfers have hostnames

Follow-up from 412cd2577ac880be4fae78808e2a1d1c00da833e

Add test 1659 to verify --connect-to when doing file:// transfers.

Reported-by: James Fuller
Closes #20948

2 months agoGHA/http3-linux: add CI reproducer for `--with-ngtcp2=<path>` regression
Viktor Szakats [Sun, 15 Mar 2026 14:07:35 +0000 (15:07 +0100)] 
GHA/http3-linux: add CI reproducer for `--with-ngtcp2=<path>` regression

Configure LibreSSL autotools job with `--with-ngtcp=<path>` instead of
adding ngtcp2 to `PKG_CONFIG_PATH`. To test this way of configuration in
CI and test for the regression reported in #20889.

Turns out this way of configuration isn't affected by the detection
issue in this particular case.

It also works for other backends except for these two, subject to
separate fixes:
- BoringSSL fix: https://github.com/ngtcp2/ngtcp2/pull/2070
- GnuTLS fix and BoringSSL workaround: #20920

Follow-up to 666db801963afca671ee5fa83bd2e9ed79fb8886 #20891
Follow-up to 8db0e286b363ad788d6dc0779d605b83c7ed4caf #18189
Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022

Closes #20926

2 months agobuild: drop `openssl` module dependency for BoringSSL from `libcurl.pc`
Viktor Szakats [Mon, 16 Mar 2026 12:36:17 +0000 (13:36 +0100)] 
build: drop `openssl` module dependency for BoringSSL from `libcurl.pc`

BoringSSL does not provide pc files, as of v0.20260211.0 (and its latest
main branch.) It also did not provide them in the past.

Its sibling fork, AWS-LC does provide them since v1.18.0 (2023-12-04):
https://github.com/aws/aws-lc/commit/7e6aef83ecf7bec3a0c6d38e38c64ac079647c78
https://github.com/aws/aws-lc/pull/1310

Introduce internal variable `OPENSSL_IS_AWSLC` to make this possible.

Bug: https://github.com/curl/curl/pull/20926#issuecomment-4063674714
Ref: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-4063725461

Closes #20938

2 months agodigest: pass in the user name quoted (as well)
Daniel Stenberg [Mon, 16 Mar 2026 15:23:49 +0000 (16:23 +0100)] 
digest: pass in the user name quoted (as well)

For cases where the user puts a double quote or backspace in the user
name.

Adjusted test 907 to verify

Reported-by: am-perip on hackerone
Closes #20940

2 months agoconfigure: prefer dependency-specific variables over `$withval`
Viktor Szakats [Mon, 16 Mar 2026 14:19:22 +0000 (15:19 +0100)] 
configure: prefer dependency-specific variables over `$withval`

Tidy up, for robustness and consistency.

Ref: #20943
Cherry-picked from #20920

Closes #20944

2 months agocurl-wolfssl.m4: fix to use the correct value for pkg-config directory
Viktor Szakats [Mon, 16 Mar 2026 17:39:53 +0000 (18:39 +0100)] 
curl-wolfssl.m4: fix to use the correct value for pkg-config directory

Before this patch the `$withval` variable may have contained `yes` or
other unrelated values, instead of the wolfSSL directory configured via
`--with-wolfssl=`.

Fixing:
```
checking for wolfssl options with pkg-config... found
configure: pkg-config --exists wolfssl trace:
---- begin
PKG_CONFIG_PATH: |/home/runner/wolfssl/build/lib/pkgconfig:/home/runner/nghttp3/build/lib/pkgconfig:/home/runner/ngtcp2/build/lib/pkgconfig:/home/runner/nghttp2/build/lib/pkgconfig|
PKG_CONFIG_LIBDIR: |yes/lib/pkgconfig|         <=============== 'yes' used as base directory
trying path: /home/runner/wolfssl/build/lib/pkgconfig for wolfssl
---- end
```
Ref: https://github.com/curl/curl/actions/runs/23146424326/job/67235762794?pr=20920#step:18:245

Cherry-picked from #20920

Closes #20943

2 months agoconfigure: also trace two important pkg-config envs
Viktor Szakats [Mon, 16 Mar 2026 17:20:51 +0000 (18:20 +0100)] 
configure: also trace two important pkg-config envs

`PKG_CONFIG_LIBDIR` and `PKG_CONFIG_PATH`.

To help debugging dependency issues. Example:
```
configure: pkg-config --exists openssl trace:
---- begin
PKG_CONFIG_LIBDIR: '/home/runner/libressl/build/lib/pkgconfig'
PKG_CONFIG_PATH: '/home/runner/libressl/build/lib/pkgconfig:/home/runner/nghttp3/build/lib/pkgconfig:/home/runner/ngtcp2/build/lib/pkgconfig:/home/runner/nghttp2/build/lib/pkgconfig'
trying path: /home/runner/libressl/build/lib/pkgconfig for openssl
trying path: /home/runner/libressl/build/lib/pkgconfig for libssl
trying path: /home/runner/libressl/build/lib/pkgconfig for libcrypto
---- end
```

Cherry-picked from #20920
Follow-up to 04d90b5deb332cd2359d5ba3f71804c55da14397 #20931

Closes #20942

2 months agoGHA/http3-linux: prefer `contains()` over `==` in job name filters
Viktor Szakats [Mon, 16 Mar 2026 16:25:31 +0000 (17:25 +0100)] 
GHA/http3-linux: prefer `contains()` over `==` in job name filters

To allow extending names without breaking logic.

Cherry-picked from #20920

Closes #20941

2 months agotool_cb_wrt: fix no-clobber error handling
Daniel Stenberg [Mon, 16 Mar 2026 13:51:52 +0000 (14:51 +0100)] 
tool_cb_wrt: fix no-clobber error handling

When saving a file with --no-clobber, make sure the existing file name
remains set when creating the name fails. In a retry scenario, it comes
back and uses that variable again.

Add test 3036 to verify.

Reported-by: James Fuller
Closes #20939

2 months agoECH.md: replace double-backticks with single ones
Viktor Szakats [Mon, 16 Mar 2026 12:41:34 +0000 (13:41 +0100)] 
ECH.md: replace double-backticks with single ones

Also fix a indent/space nits.

Closes #20937

2 months agocmake: rework binutils ld hack to not read `LOCATION` property
Viktor Szakats [Fri, 6 Mar 2026 14:43:59 +0000 (15:43 +0100)] 
cmake: rework binutils ld hack to not read `LOCATION` property

Instead hook up the upstream target name as-is to the local wrapper
target.

To:
- make the hack work regardless of how the upstream target was created.
- make it work the same way in `curl-config.cmake`.
  Before this patch it had no guard for `IMPORTED` targets even though
  `find_dependencies()` is not guaranteed to create the target expected
  if it already existed and was potentially created differently.

Depends-on: #20840
Follow-up to 4f1646ef8a9ae3052ee3e13a09c418de9ec85819 #20486 #20419

Closes #20839

2 months agoldap: drop duplicate `ldap_set_option()` on Windows
Viktor Szakats [Sun, 15 Mar 2026 16:31:35 +0000 (17:31 +0100)] 
ldap: drop duplicate `ldap_set_option()` on Windows

Already set after `ldap_sslinit()`/`ldap_init()` and before
`ldap_ssl`-specific initialization.

Follow-up to 39d1976b7f709a516e3243338ebc0443bdd8d56d #19830
Follow-up to b41e65a8e3ed8fdafb535328997bedc925f21e37
Follow-up to b91421b10764c4b7450ea29d305cc65c3f828dd1

Closes #20930

2 months agobuild: include curlx headers directly in src and tests
Viktor Szakats [Sat, 28 Feb 2026 23:54:09 +0000 (00:54 +0100)] 
build: include curlx headers directly in src and tests

To include what's actually used.

Also:
- drop unused includes.
- scope includes where possible.
- drop `curlx/curlx.h` umbrella header.
- config2setopts: include `netinet/in.h` for Cygwin/MSYS2.
  Previously included by chance via an unused curlx include.

Closes #20776

2 months agomk-ca-bundle.pl: make generated timestamps deterministic
Viktor Szakats [Thu, 5 Feb 2026 14:24:22 +0000 (15:24 +0100)] 
mk-ca-bundle.pl: make generated timestamps deterministic

With default invocation, make generated file timestamps deterministic
by looking up (via the GitHub API) the last commit that modified
`certdata.txt`, along with  its commit timestamp.

Also:
- show the URL used to download `certdata.txt` from.
- make `ca-bundle.crt` timestamp match `certdata.txt`'s.

Closes #20528

2 months agocmake: resolve imported targets recursively when generating `libcurl.pc`
Viktor Szakats [Fri, 6 Mar 2026 14:50:09 +0000 (15:50 +0100)] 
cmake: resolve imported targets recursively when generating `libcurl.pc`

To allow simplifying the binutils ld hack, by chaining the original
imported target to curl's local duplicate target. Also to allow linking
to dependencies' native imported targets via their CMake Configs, which
will always be hooked up to a `CURL::` interface, and may also be
chained upstream.

Fixing (seen on Linux with simplified binutils hack via #20839):
```
 Requires:
 Requires.private: libzstd openssl zlib
 Libs: -L${libdir} -lcurl
-Libs.private:  -lcrypto -lssl -lz -lzstd
+Libs.private:  -lOpenSSL::Crypto -lZLIB::ZLIB -lcrypto -lssl -lz -lzstd
 Cflags: -I${includedir}
 Cflags.private: -DCURL_STATICLIB
Error: Process completed with exit code
```
Ref: https://github.com/curl/curl/actions/runs/22768301699/job/66041980258?pr=20839

Note this makes it possible to run into an infinite loop because CMake
allows cyclic dependencies. It isn't added by curl's CMake script nor by
any dependencies as defined by default, but may happen in theory with
custom-created targets. In such case CMake automatically stops with
an error at 1000 iterations. I find it overkill to add custom protection
for it.

Cherry-picked from #20814
Cherry-picked from #20839

Closes #20840

2 months agocurl_get_line: fix potential infinite loop when filename is a directory
Viktor Szakats [Tue, 10 Mar 2026 00:03:13 +0000 (01:03 +0100)] 
curl_get_line: fix potential infinite loop when filename is a directory

Fix potential inifinite loop reading file content with `Curl_get_line()`
when a filename passed via these options are pointing to a directory
entry (on non-Windows):

- `--alt-svc` / `CURLOPT_ALTSVC`
- `-b` / `--cookie` / `CURLOPT_COOKIEFILE`
- `--hsts` / `CURLOPT_HSTS`
- `--netrc-file` / `CURLOPT_NETRC_FILE`

Fix by checking for this condition and silently skipping such filename
without attempting to read content. Add test 1713 to verify.

Mention in cookie documentation as an accepted case, also show a verbose
message when a directory is detected. Extend test 46 to verify if such
failure lets the logic continue to the next cookie file.

Reported-and-based-on-patch-by: Richard Tollerton
Fixes #20823
Closes #20826 (originally-based-on)
Follow-up to 769ccb4d4261a75c8a4236fbe7dc3e27956db1c9 #19140

Closes #20873

2 months agocmake: add `CURL_GCC_ANALYZER` option, enable in CI, fix/silence
Viktor Szakats [Fri, 13 Mar 2026 15:42:16 +0000 (16:42 +0100)] 
cmake: add `CURL_GCC_ANALYZER` option, enable in CI, fix/silence

Enable in one existing Linux, macOS and Windows job.

Cost:
- Linux: +1.3 minutes.
- macOS: +1.5 minutes.
- Windows: +2.5 minutes.

Fix or silence issues found:
- conncache: silence NULL deref warning.
  ```
  lib/conncache.c:564:18: warning: dereference of NULL '*data.multi' [CWE-476] [-Wanalyzer-null-dereference]
  ```
  Ref: ede6a8e08762321d95864ad384b8ff5ac44ac459 #19378
- http2: check pointer for NULL.
  ```
  lib/http2.c:388:7: error: dereference of NULL ‘data’ [CWE-476] [-Wanalyzer-null-dereference]
  ```
- http2: silence potential NULL deref in `cf_h2_recv`.
  ```
  lib/http2.c: In function 'cf_h2_recv':
  lib/curl_trc.h:62:15: warning: dereference of NULL 'data' [CWE-476] [-Wanalyzer-null-dereference]
  ```
- openldap: silence deref before NULL check.
  Seen in GHA/Linux.
  ```
  lib/openldap.c: In function ‘oldap_state_mechs_resp’:
  lib/curl_trc.h:140:7: warning: check of ‘data’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  ```
- sendf: silence NULL deref false positive in `Curl_creader_set_fread`.
  It looks impossible to happen.
  ```
  lib/sendf.c:1133:7: warning: dereference of NULL 'r' [CWE-476] [-Wanalyzer-null-dereference]
  ```
- ws: silence deref before NULL check.
  ```
  lib/ws.c: In function 'ws_send_raw_blocking':
  lib/curl_trc.h:205:7: warning: check of 'data' for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  ```
- var: fix potential NULL deref
  ```
  src/var.c:216:29: warning: dereference of NULL 'envp' [CWE-476] [-Wanalyzer-null-dereference]
  ```
- cli_hx_upload.c: fix NULL check after dereference.
  ```
  tests/libtest/cli_hx_upload.c:170:7: warning: check of '*t.method' for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  ```
- unit1607, unit1609: fix theoretical NULL ptr dereference.
  ```
  tests/unit/unit1607.c:211:12: warning: dereference of NULL 'addr' [CWE-476] [-Wanalyzer-null-dereference]
  tests/unit/unit1609.c:193:12: warning: dereference of NULL 'addr' [CWE-476] [-Wanalyzer-null-dereference]
  ```
- globally disable checks triggering false positives only:
  ```
  docs/examples/externalsocket.c:135:8: warning: 'connect' on possibly invalid file descriptor 'sockfd' [-Wanalyzer-fd-use-without-check]
  lib/bufq.c:465:16: warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop] (gcc-15 Windows)
  lib/doh.c:1035:34: warning: stack-based buffer over-read [CWE-126] [-Wanalyzer-out-of-bounds] (gcc-15 macOS)
  lib/ftp.c:4022:20: warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop] (gcc-15 macOS)
  lib/http2.c:689:28: warning: buffer over-read [CWE-126] [-Wanalyzer-out-of-bounds] (gcc-15 macOS)
  lib/socketpair.c:195:5: warning: leak of file descriptor 'curl_dbg_socket(2, 1, 0, 192, "D:/a/curl/curl/lib/socketpair.c")' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_doswin.c:810:7: warning: leak of file descriptor '*tdata.socket_l' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_doswin.c:816:9: warning: leak of file descriptor '*tdata.socket_l' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_main.c:96:1: warning: leak of file descriptor 'fd[0]' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_main.c:96:1: warning: leak of file descriptor 'fd[1]' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_urlglob.c:48:17: warning: leak of 'malloc(8)' [CWE-401] [-Wanalyzer-malloc-leak]
  src/tool_writeout.c:870:3: warning: leak of FILE 'stream2' [CWE-775] [-Wanalyzer-file-leak]
  tests/libtest/lib518.c:90:1: warning: leak of FILE [CWE-775] [-Wanalyzer-file-leak]
  tests/libtest/lib537.c:87:1: warning: leak of FILE [CWE-775] [-Wanalyzer-file-leak]
  tests/server/tftpd.c:1147:10: warning: 'bind' on possibly invalid file descriptor 'sock' [-Wanalyzer-fd-use-without-check]
  tests/server/tftpd.c:1155:10: warning: 'bind' on possibly invalid file descriptor 'sock' [-Wanalyzer-fd-use-without-check]
  tests/server/tftpd.c:1259:10: warning: 'connect' on possibly invalid file descriptor '4294967295' [-Wanalyzer-fd-use-without-check]
  ```

Also:
- cmake: update clang-tidy typecheck comment.

Ref: https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html

Closes #20921

2 months agoconfigure: add option to trace pkg-config detection details
Viktor Szakats [Sun, 15 Mar 2026 14:07:35 +0000 (15:07 +0100)] 
configure: add option to trace pkg-config detection details

To aid debugging cases when dependency detection acts unexpectedly.
Sprung from spending days trying to figure out behavior of ngtcp2 crypto
modules and their dependencies.

You can enable by setting env `CURL_TRACE_PKG_CONFIG` to a non-empty
value. When enabled, details are logged for both successful and
unsuccessful detections. Logging of unsuccessful ones is automatically
enabled when `CURL_CI` env is set, which is the case for all CI jobs.

It works by asking for `--debug` output and grepping for lines that seem
useful for this purpose. Output is different for classic pkg-config and
pkgconf, and may depending on tool version. Also append `--print-errors`
output if any.

Examples (with pkgconf):

Fail, before:
```
checking for libngtcp2_crypto_boringssl options with pkg-config... no
configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file.
```

Fail, after:
```
checking for libngtcp2_crypto_boringssl options with pkg-config... no
configure: pkg-config --exists libngtcp2_crypto_boringssl trace:
---- begin
trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/nghttp3/build/lib/pkgconfig for openssl
trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for openssl
trying path: /home/runner/nghttp2/build/lib/pkgconfig for openssl
==== error:
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'libngtcp2_crypto_boringssl', not found
---- end
configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file.
```

Success, after:
```
checking for libngtcp2_crypto_boringssl options with pkg-config... found
configure: pkg-config --exists libngtcp2_crypto_boringssl trace:
---- begin
trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/awslc/build/lib/pkgconfig for openssl
trying path: /home/runner/awslc/build/lib/pkgconfig for libssl
trying path: /home/runner/awslc/build/lib/pkgconfig for libcrypto
---- end
```

More examples:
https://github.com/curl/curl/pull/20926#issuecomment-4064259935

If there is an externally enablable, built-in feature like this in
classic pkg-config or pkgconf, I could not find it.

Also:
- GHA/http3-linux: set `CURL_TRACE_PKG_CONFIG` to log detection details.
  H3 builds are prone to hard-to-debug dependency issues.

Ref: #20920
Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188
Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022

Cherry-picked from #20926

Closes #20931

2 months agoldap: fix to initialize cleartext connection on Windows
Viktor Szakats [Sun, 15 Mar 2026 15:55:24 +0000 (16:55 +0100)] 
ldap: fix to initialize cleartext connection on Windows

Regression since curl 8.18.0.

Reported-by: Yoshiro Yoneya
Fixes #20927
Follow-up to 39d1976b7f709a516e3243338ebc0443bdd8d56d #19830

Closes #20928

2 months agobadwords-all: exit with correct code on errors
Daniel Stenberg [Mon, 16 Mar 2026 09:37:54 +0000 (10:37 +0100)] 
badwords-all: exit with correct code on errors

Problems remain undetected in CI otherwise

Closes #20934

2 months agobadwords: detect the the and with with
Daniel Stenberg [Mon, 16 Mar 2026 09:28:38 +0000 (10:28 +0100)] 
badwords: detect the the and with with

They seem to be the most common mistaken repeated words

Ref #20933

Closes #20934