Commit Graph

38400 Commits

Author SHA1 Message Date
Daniel Stenberg
dd7fcd581f
lib: accept larger input to md5/hmac/sha256/sha512 functions
Avoid unchecked data conversions from size_t to unsigned int.

Reported-by: James Fuller
Closes #21174
2026-03-31 17:19:56 +02:00
Viktor Szakats
1570091f10
INSTALL.md: refer to as Cygwin
Replacing `cygwin`.

Closes #21179
2026-03-31 17:17:47 +02:00
Viktor Szakats
f14d9e6efc
cmake: enable pthreads for BoringSSL/AWS-LC
Depends on 6828df7d21 #21176

Closes #21168
2026-03-31 17:17:47 +02:00
Daniel Stenberg
c31fcf2dec
docs: SSH host verification is done at connect time
Connection reuse is done more "casually" once verified.

Closes #21173
2026-03-31 17:15:47 +02:00
John Haugabook
c1f7ffd572
INSTALL.md: update Cygwin instructions
Polish Cygwin section of install, adding suggestions for:

- `cmake`
- `ninja`
- `setup --build-depends`

Closes #20995
2026-03-31 16:49:57 +02:00
Viktor Szakats
6828df7d21
cmake: improve passing build options to try_compile()
Pass build options directly via `COMPILE_DEFINTIONS` and
`LINK_LIBRARIES`, instead of "tunneling" them through `CMAKE_FLAGS`.
The latter method breaks when passing `Threads::Threads` as library via
`CMAKE_REQUIRED_LIBRARIES`, while also being complex and fragile.

Example:
```
-- Performing Test HAVE_FSETXATTR_5
CMake Error at bld/CMakeFiles/CMakeTmp/CMakeLists.txt:27 (target_link_libraries):
  Target "cmTC_3386e" links to:

    Threads::Threads

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

CMake Error at CMake/Macros.cmake:51 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  CMakeLists.txt:1684 (curl_internal_test)
```
Ref: https://github.com/curl/curl/actions/runs/23792043930/job/69329796592?pr=21168#step:38:318

Note: a side-effect is no longer passing C compiler flags (e.g.
`CMAKE_REQUIRED_FLAGS`) to the _linker_. This should not be an issue,
though CMake is passing them during its built-in detections.

Ref: https://cmake.org/cmake/help/v3.18/command/try_compile.html

Closes #21176
2026-03-31 13:23:46 +02:00
Daniel Stenberg
3e677a9a26
RELEASE-NOTES: synced 2026-03-31 09:02:47 +02:00
Daniel Stenberg
9b36748938
http2: return error on OOM in push headers
Reported-by: M42kL33 on hackerone
Bug: https://hackerone.com/reports/3636044
Closes #21171
2026-03-31 08:59:07 +02:00
Daniel Stenberg
2f93a0e6bb
CURLOPT_SSL_CTX_FUNCTION.md: expand on effects connection reuse
Closes #21164
2026-03-31 07:50:56 +02:00
Daniel Stenberg
8e89646a3d
tool_operhlp: iterate through all slashes to find name
If there is no trailing file name for -O or --remote-name-all, continue
searching until there is no more to search. A URL ending with multiple
slashes would previously make it do wrong.

Add test 1639 and 1644 to verify.

Follow-up to e26eefd9ce

Reported-by: James Fuller

Closes #21165
2026-03-31 07:43:47 +02:00
Dan Fandrich
bae6237c45 docs: list more dependencies for running Python HTTP tests
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
Reviewed-by: Viktor Szakats <commit@vsz.me>
Closes #21110
2026-03-30 21:54:39 -07:00
Viktor Szakats
b9690e9cd1
cmake: silence bad library Threads::Threads warning
Seen on macOS:
```
CMake Warning at CMakeLists.txt:2158 (message):
  Bad lib in library list: Threads::Threads
```

Follow-up to 2d546d239e #21163

Closes #21170
2026-03-31 05:33:45 +02:00
Viktor Szakats
e49190f9f3
cf-https-connect: silence -Wimplicit-int-enum-cast with HTTPS-RR + clang 21 (reapply)
Reapply: e09a7b83d6 #21057

Also:
- enable HTTPS-RR by default in curl-for-win to test it with clang 21.
  Ref: dc65c449f3

Follow-up to 335dc0e3c5 #21027

Closes #21167
2026-03-31 03:32:36 +02:00
renovate[bot]
9dc3c06aa7
GHA: update dependency google/boringssl to v0.20260327.0
Closes #21166
2026-03-31 00:51:04 +02:00
Viktor Szakats
2d546d239e
cmake: use Threads::Threads imported target for POSIX Threads
- use `Threads::Threads` imported target, replacing
  `CMAKE_THREAD_LIBS_INIT`. To use the modern form and to allow using
  `THREADS_PREFER_PTHREAD_FLAG` option.

- only add Threads library/options if POSIX Threads was detected (not
  any other threading backend FindThreads may detect, e.g. the HP one.)

- curl-config.in.cmake: detect and define `Threads::Threads`.

Refs:
https://cmake.org/cmake/help/v3.18/module/FindThreads.html
https://cmake.org/cmake/help/v4.3/module/FindThreads.html

Closes #21163
2026-03-31 00:51:04 +02:00
Viktor Szakats
ce6c441cf2
build: drop redundant HAVE_PTHREAD_H guard
Prior to this patch code used either `HAVE_PTHREAD_H`, or
`HAVE_THREADS_POSIX`, or both, to decide if POSIX Threads support is
present. In effect requiring both to be defined for a consistent build.

Drop detecting and guarding for `pthread.h`, and assume it present when
`HAVE_THREADS_POSIX` is set.

OS/400 had `HAVE_PTHREAD_H` set, but not `HAVE_THREADS_POSIX`, which
possibly left threading disabled in most sources.

Ref: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/pthread.h.html
Ref: 930f2e8227 #21144

Closes #21158
2026-03-30 18:57:07 +02:00
Daniel Stenberg
9f7295fb23
test445: fix error code, remove SMB use
The test should now expect error 7. SMB is now opt-in, so not used in as
many builds anymore.

Follow-up to a186ecf4bf

Closes #21160
2026-03-30 18:50:44 +02:00
Daniel Stenberg
7deed5bb55
wolfssl: fix build without TLS 1.3 support
Follow-up to: eac64c1879

Closes #21161
2026-03-30 18:50:02 +02:00
Stefan Eissing
8deaf04feb
fopen: for temp files, inherit permissions only for owner
When creating a temp file in order to later replace an original, copying
over the existing permissions can not be considered safe when the user
running libcurl is not the owner of the existing file.

Closes #21092
2026-03-30 18:39:12 +02:00
Daniel Stenberg
eac64c1879
wolfssl: refactor Curl_wssl_ctx_init into sub functions
Reduce complexity. It was at complexity 60, with is the current max
allowed. After this, the worst in wolfssl.c is at 29.

Closes #21128
2026-03-30 16:46:53 +02:00
MarkLee131
9fcc7e4c43
tool: fix two more allocator mismatches
memory allocated by libcurl (curl_maprintf) must be freed with
curl_free(), and memory allocated by the tool (curlx_strdup via
findfile) must be freed with curlx_free().

- tool_cfgable: ech_config is allocated with curl_maprintf, free it
  with curl_free() instead of tool_safefree()
- config2setopts: known hosts from findfile() is allocated with
  curlx_strdup, free it with curlx_free() instead of curl_free()

Follow-up to b71973c115

Closes #21150
2026-03-30 16:17:42 +02:00
Kaixuan Li
2c26cea5ec
socks: add assertion for hostname length in SOCKS5 connect
socks5_req0_init() rejects hostnames longer than 255 bytes, but the
later cast to unsigned char in socks5_req1_init() has no local
indication that it is safe. Add a DEBUGASSERT and comment to document
the invariant and guard against future refactoring.

Closes #21157
2026-03-30 16:13:24 +02:00
Greg Kroah-Hartman
fb6925c243
socks: reject zero-length GSSAPI/SSPI tokens from proxy
A "broken" SOCKS5 proxy can send an invalid length of the encryption
token, which could cause malloc(0) to be called, which is a "platform
can do what it wants" potential problem.

Resolve this by explicitly checking the length and rejecting the invalid
token before ever attempting to allocate any memory.

Closes #21159
2026-03-30 16:07:06 +02:00
Viktor Szakats
930f2e8227
build: drop duplicate pthread.h includes
Already included from `curl_setup.h`.

Closes #21144
2026-03-30 13:46:14 +02:00
Viktor Szakats
3c72928471
build: drop redundant USE_QUICHE guards
When used together with `USE_OPENSSL`. `USE_QUICHE` always implies
`USE_OPENSSL`.

Also: merge two (now identical) `#if` blocks in `openssl.c`.

Closes #21135
2026-03-30 13:46:14 +02:00
Viktor Szakats
9f66cdddf4
tool_dirhie: stop redefining system symbol mkdir
Replace with local macro `toolx_mkdir()`, and map that to
platform-specific implementations as necessary.

Closes #21133
2026-03-30 13:46:14 +02:00
Viktor Szakats
20b18a43f6
src: drop detecting and redefining system symbol ftruncate
Introduce `toolx_ftruncate()` macro and map it to existing replacements
for non-mingw-w64 Windows and DJGPP, or to `ftruncate` otherwise.

Follow-up to 6041b9b11b #21109

Closes #21130
2026-03-30 13:46:14 +02:00
Stefan Eissing
335dc0e3c5
cf-dns: connection filter for DNS queries
New connection filter `cf-dns` that manages DNS queries. If hands
out addresses and HTTPS-RR records to anyone interested. Used by
HTTPS and IP happy eyeballing.

Information may become available *before* the libcurl "dns entry"
is complete, e.g. all queries have been answered. The cf-ip-happy
filter uses this information to start connection attempts as soon
as the first address is available.

The multi MSTATE_RESOLVING was removed. A new connection always
goes to MSTATE_CONNECTING. The connectdata bit `dns_resolved`
indicates when DNS information is complete. This is used for
error reporting and starting the progress meter.

Removed dns entries `data->state.dns[i]`, as the `cf-dns` filter
now keeps the reference now.

Many minor tweaks for making this work and pass address information
around safely.

Closes #21027
2026-03-30 13:28:38 +02:00
Viktor Szakats
89741958e8
cmake: use AIX built-in variable (with CMake 4.0+)
Also keep the old method for compatibility with CMake <4.0.

Ref: https://cmake.org/cmake/help/v4.0/variable/AIX.html

Closes #21134
2026-03-30 13:05:17 +02:00
Viktor Szakats
3502c5159b
GHA/linux: drop slow server logic for non-Azure source [ci skip]
Ref: https://github.com/curl/curl/actions/runs/23740539514/job/69156214117
Follow-up to 5172ba5475 #21107
2026-03-30 13:02:24 +02:00
Viktor Szakats
9dfe69cb3c
GHA/windows: bump to stunnel 5.77 (from 5.76)
Ref: https://www.stunnel.org/mailman3/hyperkitty/list/stunnel-announce@lists.stunnel.org/thread/BLYG54UILDIADJC2HWVFWQ2MK2YC3HOM/

Closes #21154
2026-03-30 11:00:37 +02:00
Viktor Szakats
89dbe84fdf
curl_ngtcp2: extend and update callbacks for 1.22.0+
Fixing:
```
lib/vquic/curl_ngtcp2.c:880:1: error: missing field 'recv_stateless_reset2' initializer [-Wmissing-field-initializers]
  880 | };
      | ^
```

Also:
- GHA/http3-linux: bump to ngtcp2 v1.22.0.

Refs:
https://github.com/ngtcp2/ngtcp2/releases/tag/v1.22.0
b7bfe41db8
https://github.com/ngtcp2/ngtcp2/pull/2035

Closes #21152
2026-03-30 10:59:38 +02:00
Daniel Stenberg
78cf1566f1
docs: mention more zip bomb precautions
Closes #21143
2026-03-29 23:42:11 +02:00
Daniel Stenberg
d87d4022aa
tool_operate: actually apply the --parallel-max-host limit
It was wrongly previously only used in debug code for event based
transfer and not in the "normal" parallel transfer case.

Follow-up to 4654493fed

Closes #21147
2026-03-29 18:59:34 +02:00
Daniel Stenberg
8f3f470bae
tool_cb_rea: make waitfd() return void
Nothing cared about the return code. Simplified.

Closes #21127
2026-03-28 23:00:42 +01:00
Dexter Gerig
fde2e9a6b2
configure: remove superfluous experimental warning for HTTP/3
This warning was created at a time when all backends for HTTP/3 were
experimental. Since there are now non-experimental backends this warning
is incorrect in some cases and was already handled by backends that were
added to the experimental list.

Follow-up to 0535f6ec71

Closes #21139
2026-03-28 22:59:22 +01:00
Viktor Szakats
f0f0a7f7d6
boringssl: fix more coexist cases with Schannel/WinCrypt
By moving the coexist workaround from vtls/openssl.c to vtls/openssl.h.
This way it also applies to vtls.c (and possibly other sources including
`vtls/openssl.h`), which may need it in unity builds before BoringSSL
header `openssl/ssl.h` pulling in the conflicting symbols and causing
conflicts otherwise.

Seen with build config:
```
-DCURL_USE_SCHANNEL=ON -DCURL_USE_OPENSSL=ON
-DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30
```

Fixing:
```
In file included from _cm-win-boringssl/lib/CMakeFiles/libcurl_object.dir/Unity/unity_5_c.c:7:
In file included from lib/vtls/vtls.c:54:
In file included from lib/vtls/openssl.h:33:
In file included from /path/to/boringssl/_x64-win-ucrt/usr/include/openssl/opensslv.h:18:
In file included from /path/to/boringssl/_x64-win-ucrt/usr/include/openssl/crypto.h:18:
/path/to/boringssl/_x64-win-ucrt/usr/include/openssl/base.h:293:29: error: expected ')'
  293 | typedef struct X509_name_st X509_NAME;
      |                             ^
/path/to/llvm-mingw/x86_64-w64-mingw32/include/wincrypt.h:1515:29: note: expanded from macro 'X509_NAME'
 1515 | #define X509_NAME ((LPCSTR) 7)
      |                             ^
[...]
```

Ref: 2a92c39a21 #20567

Closes #21136
2026-03-28 15:52:41 +01:00
Viktor Szakats
9b01f73ac2
keylog.h: replace literal number with macro in declaration
Also syncing with the defintion.

Closes #21141
2026-03-28 15:51:04 +01:00
Viktor Szakats
31ec67651a
keylog: drop unused/redundant includes and guards
Closes #21137
2026-03-28 12:20:03 +01:00
dependabot[bot]
bb0c8cf5af
GHA: bump pip-dependencies
- update `filelock` from 3.24.3 to 3.25.2
- update `ruff` from 0.15.2 to 0.15.7
- update `cryptography` from 46.0.5 to 46.0.6 (CVE-2026-34073)

Closes #21138
2026-03-28 03:43:26 +01:00
Viktor Szakats
f1bdbd25e3
mk-ca-bundle.pl: tidy up more leftovers
Follow-up to 351e4f956a #21116
Follow-up to ca92e20123 #20528

Closes #21131
2026-03-28 00:55:09 +01:00
Viktor Szakats
30462cd66f
GHA/http3-linux: fix openssl4 version in cache keys
Follow-up to 7523de760d #21118

Closes #21132
2026-03-28 00:49:46 +01:00
Daniel Stenberg
4f316230fd
tool_util: fix the ftruncate use for DJGPP
Follow-up to 6041b9b11b

Since we define ftruncate as a macro, we can't use the macro within
the function!

Closes #21125
2026-03-27 16:51:07 +01:00
Daniel Stenberg
d7d683c3ba
tool_cb_hdr: use the file descriptor instead of calling fileno() again
Follow-up to 6041b9b11b

Closes #21126
2026-03-27 16:50:28 +01:00
Daniel Stenberg
ff678be69a
libssh: propagate error back in SFTP function
The myssh_in_SFTP_READDIR_BOTTOM() function would not store the error
code correctly thus it could be ignored and missed when an error was
returned at that particular moment.

Follow-up to 3c26e6a896

Found by Codex Security

Closes #21122
2026-03-27 16:12:51 +01:00
Daniel Stenberg
86b39c2226
transfer: clear the URL pointer in OOM to avoid UAF
Since the pointer can be extracted with CURLINFO_EFFECTIVE_URL later it
must not linger pointing to freed memory.

Found by Codex Security

Closes #21123
2026-03-27 15:56:12 +01:00
Daniel Stenberg
28fbf4a87d
multi: fix connection retry for non-http
non-HTTP protocols no longer retry after connection reuse failures
because multi_follow() now requires a handler->follow callback that is
NULL for those protocols. Provide a fallback for plain retries.

Follow-up to 1213c31272

Spotted by Codex Security

Closes #21121
2026-03-27 15:54:22 +01:00
Stefan Eissing
2e8c922a89
http2: prevent secure schemes pushed over insecure connections
When assembling the URL of a pushed resource over a not-secured
connection, require the scheme to be known and not secure.

Reported-by: xkilua on hackerone

Closes #21113
2026-03-27 14:23:29 +01:00
Viktor Szakats
351e4f956a
mk-ca-bundle.pl: drop reproducible timestamp feature
Mozilla may push to its repo much later than the commit date, which can
be a source of confusion when using the reproducible timestamp (which is
determined by the commit date) by default. Example:

https://curl.se/ca/cacert-2026-03-19.pem vs.
1a84aee638/security/nss/lib/ckfw/builtins/certdata.txt

This feature had no actual user (or a planned one) from within curl at
the moment, and not requested by curl users. curl-for-win does this on
its own, which is the more practical way there since everything (not
just the CA bundle) needs to be reproducible anyway. I surmise this may
be true for most if not all reproducible use-cases.

Another limitation was that it could bump into GitHub's rate limiting,
needing further updates.

Also: code had some unintented leftovers.

Reported-by: Daniel Stenberg
Bug: https://github.com/curl/curl/pull/20528#issuecomment-4140610008
Follow-up to ca92e20123 #20528

Closes #21116
2026-03-27 14:19:31 +01:00
Viktor Szakats
7523de760d
GHA/http3-linux: add OpenSSL 4 beta jobs, with ECH
Closes #21118
2026-03-27 12:23:12 +01:00