]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
5 weeks agoexamples: fix two more cases of `stat()` TOCTOU
Viktor Szakats [Tue, 30 Sep 2025 09:41:11 +0000 (11:41 +0200)] 
examples: fix two more cases of `stat()` TOCTOU

Also:
- ftpupload: bump an intermediate variable size.

Follow-up to f13250edf11312ab8c0425cf39b182a31b53c6f7 #18605

Closes #18778

5 weeks agoDockerfile: update debian:bookworm-slim digest to 7e49091
renovate[bot] [Tue, 30 Sep 2025 01:14:11 +0000 (01:14 +0000)] 
Dockerfile: update debian:bookworm-slim digest to 7e49091

Closes #18777

5 weeks agochecksrc: fix possible endless loop when detecting `BANNEDFUNC`
Viktor Szakats [Mon, 29 Sep 2025 23:46:33 +0000 (01:46 +0200)] 
checksrc: fix possible endless loop when detecting `BANNEDFUNC`

If the source line had square brackets before the match, the stripping
of the banned function left the original line intact, and repeated the
check on it forever. E.g. with banned function `open` in `lib518.c`:
```c
t518_testfd[0] = open(DEV_NULL, O_RDONLY);
```

Closes #18775

5 weeks agobuild: avoid overriding system symbols for fopen functions
Viktor Szakats [Sun, 14 Sep 2025 13:34:18 +0000 (15:34 +0200)] 
build: avoid overriding system symbols for fopen functions

By introducing wrappers for them in the curlx namespace:
`curlx_fopen()`, `curlx_fdopen()`, `curlx_fclose()`.

The undefine/redefine/`(function)()` methods broke on systems
implementing these functions as macros. E.g. AIX 32-bit's `fopen()`.

Also:
- rename `lib/fopen.*` to `lib/curl_fopen.*` (for `Curl_fopen()`)
  to make room for the newly added `curlx/fopen.h`.
- curlx: move file-related functions from `multibyte.c` to `fopen.c`.
- tests/server: stop using the curl-specific `fopen()` implementation
  on Windows. Unicode isn't used by runtests, and it isn't critical to
  run tests on longs path. It can be re-enabled if this becomes
  necessary, or if the wrapper receives a feature that's critical for
  test servers.

Reported-by: Andrew Kirillov
Bug: https://github.com/curl/curl/issues/18510#issuecomment-3274393640

Follow-up to bf7375ecc50e857760b0d0a668c436e208a400bd #18503
Follow-up to 9863599d69b79d290928a89bf9160f4e4e023d4e #18502
Follow-up to 3bb5e58c105d7be450b667858d1b8e7ae3ded555 #17827

Closes #18634

5 weeks agotests/server: drop unsafe `open()` override in signal handler (Windows)
Viktor Szakats [Mon, 29 Sep 2025 20:48:55 +0000 (22:48 +0200)] 
tests/server: drop unsafe `open()` override in signal handler (Windows)

Turns out the signal handler on Windows still wasn't signal safe after
the previous round of fix. There is an `open()` call made from there,
and `open` happens to be unconditionally overridden via `curl_setup.h`
on Windows, to its local implementation (`curlx_win32_open()`), which
does memory allocations and potentially other things that are not signal
safe.

This is a temporary fix, till avoiding the override of system symbols
`open` and `stat` on Windows.

FTR this did not fix the CI 2304 errors, diskspace fail or job hangs due
to 0xC0000142 fork failure (it's rare all three occurs in the same run):
https://github.com/curl/curl/actions/runs/18110523584?pr=18774

Ref: #18634
Follow-up e95f509c66abdd88ae02e3243cdc217f19c4a330 #16852
Closes #18774

5 weeks agocmake: use more `COMPILER_OPTIONS`, `LINK_OPTIONS` / `LINK_FLAGS`
Viktor Szakats [Sun, 28 Sep 2025 00:34:13 +0000 (02:34 +0200)] 
cmake: use more `COMPILER_OPTIONS`, `LINK_OPTIONS` / `LINK_FLAGS`

- replace `COMPILE_FLAGS` with `COMPILE_OPTIONS` that superceded it.

  Follow-up to 6140dfcf3e7845f11dee755de6865379aa96dab7
  https://cmake.org/cmake/help/v4.1/prop_sf/COMPILE_FLAGS.html

- replace `target_link_libraries()` with `LINK_FLAGS` property for
  CMake <=3.12, because we are passing linker options (not libs).

  Follow-up to 91720b620e802748d2e1629f43e29b76736542f9 #18468
  Follow-up to 548873921cde197aa1d40216c594c76738031374 #17670
  Follow-up to 95aea798dbd785c4daee2b2e24f2c8c94f3e3cf4 #5843
  https://cmake.org/cmake/help/v3.7/command/target_link_libraries.html
  https://cmake.org/cmake/help/v3.7/prop_tgt/LINK_FLAGS.html

- replace `target_link_options()` with `LINK_OPTIONS` propery for
  CMake 3.13+, to use the modern style.

  Follow-up to 91720b620e802748d2e1629f43e29b76736542f9 #18468
  Follow-up to 548873921cde197aa1d40216c594c76738031374 #17670
  https://cmake.org/cmake/help/v3.13/command/target_link_options.html
  https://cmake.org/cmake/help/v3.13/prop_tgt/LINK_OPTIONS.html

Also:

- fix to append to, not override, previously set linker options when
  using `CURL_LIBCURL_VERSIONED_SYMBOLS=ON`. Before this patch, it was
  overwriting linker options when using `CURL_CODE_COVERAGE=ON`.

  Follow-up to 91720b620e802748d2e1629f43e29b76736542f9 #18468

Closes #18762

5 weeks agoGHA/linux-old: make one cmake v3.7.2 job verbose
Viktor Szakats [Sun, 28 Sep 2025 09:54:57 +0000 (11:54 +0200)] 
GHA/linux-old: make one cmake v3.7.2 job verbose

To show the details in cmake builds using the oldest supported version.
Use a legacy method. `--verbose` became supported later, in 3.14.

Closes #18764

5 weeks agoCI: make pip use `tests/requirements.txt` in Circle CI
Viktor Szakats [Sat, 27 Sep 2025 22:32:49 +0000 (00:32 +0200)] 
CI: make pip use `tests/requirements.txt` in Circle CI

Also sync `pip` options with those used in GHA.

Closes #18760

5 weeks agoci: use `--enable-option-checking=fatal` in autotools jobs
Viktor Szakats [Sat, 27 Sep 2025 21:51:46 +0000 (23:51 +0200)] 
ci: use `--enable-option-checking=fatal` in autotools jobs

To avoid typos and non-existing options passed to `./configure` in CI
builds.

Also delete obsolete option `--enable-test-bundles` from Circle CI jobs.

Closes #18759

5 weeks agoGHA/windows: tidy up Cygwin jobs
Viktor Szakats [Sat, 27 Sep 2025 15:58:29 +0000 (17:58 +0200)] 
GHA/windows: tidy up Cygwin jobs

- drop unnecessary installed packages.
- sync built type name with other jobs.

Closes #18758

5 weeks agoGHA: update dependency awslabs/aws-lc to v1.61.4
renovate[bot] [Fri, 26 Sep 2025 21:53:21 +0000 (21:53 +0000)] 
GHA: update dependency awslabs/aws-lc to v1.61.4

Closes #18752

5 weeks agoGHA/linux: tidy up AWS-LC local build
Viktor Szakats [Sat, 27 Sep 2025 11:02:12 +0000 (13:02 +0200)] 
GHA/linux: tidy up AWS-LC local build

To sync with other builds and to use `-B` to avoid a cmake warning and
future breakage.

Closes #18757

5 weeks agotidy-up: miscellaneous
Viktor Szakats [Tue, 16 Sep 2025 17:28:27 +0000 (19:28 +0200)] 
tidy-up: miscellaneous

- GHA/checkdocs: rename `spellcheck` job to `pyspelling` to say
  the exact tool used.
- GHA/checkdocs: restore a comment.
- GHA/linux: add `-B .` to a cmake configure to avoid warning, and
  future breakage.
- autotools: use correct casing for `Schannel`.
- doh: update RFC URL.
- drop redundant parenthesis.
- fix indentation, whitespace.

Closes #18756

5 weeks agoperlcheck: parallelize
Viktor Szakats [Fri, 26 Sep 2025 18:57:16 +0000 (20:57 +0200)] 
perlcheck: parallelize

Follow-up to 34b1e146e42f2dbac5c89414a2a0458a8729a255 #18745

Closes #18750

6 weeks agocf-ip-happy: mention unix domain path, not port number
Daniel Stenberg [Fri, 26 Sep 2025 14:30:34 +0000 (16:30 +0200)] 
cf-ip-happy: mention unix domain path, not port number

In the connect error message if a unix domain socket was used.

Reported-by: kuchara on github
Ref: #18748
Closes #18749

6 weeks agoperlcheck: add script, run in CI, fix fallouts
Viktor Szakats [Wed, 24 Sep 2025 23:54:28 +0000 (01:54 +0200)] 
perlcheck: add script, run in CI, fix fallouts

Add script to run all Perl sources through `perl -c` to ensure no
issues, and run this script via GHA/checksrc in CI.

Fallouts:
- fix two repeated declarations.
- move `shell_quote()` from `testutil.pm` to `pathhelp.pm`, to
  avoid circular dependency in `globalconfig.pm`.

Closes #18745

6 weeks agoopenldap: check ber_sockbuf_add_io() return code
Daniel Stenberg [Fri, 26 Sep 2025 11:53:04 +0000 (13:53 +0200)] 
openldap: check ber_sockbuf_add_io() return code

The man page says nothing about what the return code means but Howard
Chu tells me it is 0 on success, -1 on fail.

Help-by: Howard Chu
Closes #18747

6 weeks agotool_progress: handle possible integer overflows
Daniel Stenberg [Fri, 26 Sep 2025 07:43:19 +0000 (09:43 +0200)] 
tool_progress: handle possible integer overflows

The progress meters max out at 2^63 bytes.

Reported-by: BobodevMm on github
Fixes #18744
Closes #18746

6 weeks agohttp: handle user-defined connection headers
Stefan Eissing [Mon, 22 Sep 2025 13:48:07 +0000 (15:48 +0200)] 
http: handle user-defined connection headers

When there is more than one user-supplied 'Connection: ' header, add
values that curl needs internally to the first one and emit all
subsequent ones thereafter.

Fixes #18662
Reported-by: Evgeny Grin (Karlson2k)
Closes #18686

6 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 25 Sep 2025 21:35:31 +0000 (23:35 +0200)] 
RELEASE-NOTES: synced

6 weeks agoopenssl: fail the transfer if ossl_certchain() fails
Daniel Stenberg [Sat, 20 Sep 2025 20:32:23 +0000 (22:32 +0200)] 
openssl: fail the transfer if ossl_certchain() fails

Since it would indicate errors to the degree that continuing would just
risk hiding the earlier errors or make things weird.

Inspired by a report in Joshua's sarif data

Closes #18646

6 weeks agoGHA: update dependency ruff and github/codeql-action
renovate[bot] [Thu, 25 Sep 2025 15:03:08 +0000 (15:03 +0000)] 
GHA: update dependency ruff and github/codeql-action

- update github/codeql-action digest to 303c0ae
- update dependency ruff to v0.13.2

Closes #18716
Closes #18734

6 weeks agolibssh: acknowledge SSH_AGAIN in the SFTP state machine
Daniel Stenberg [Thu, 25 Sep 2025 14:38:49 +0000 (16:38 +0200)] 
libssh: acknowledge SSH_AGAIN in the SFTP state machine

Reported in Joshua's sarif data

Closes #18740

6 weeks agolibssh: clarify myssh_block2waitfor
Daniel Stenberg [Thu, 25 Sep 2025 14:32:18 +0000 (16:32 +0200)] 
libssh: clarify myssh_block2waitfor

Fixed misleading comment. Simplified the bit setup.

Reported in Joshua's sarif data

Closes #18739

6 weeks agoGHA: use `pyspelling` directly
Viktor Szakats [Thu, 25 Sep 2025 12:50:15 +0000 (14:50 +0200)] 
GHA: use `pyspelling` directly

To avoid depending on Docker Hub, an Docker image and a GitHub Action.
Also to simplify running this check on a local machine.

Pending question if Dependabot and Mend/Renovate will automatically pick
up `requirements-docs.txt`.

Also:
- enable parallel spellchecking. (also to win back the time lost with
  installing components directly from Debian and pip.)
- pin `pyspelling`.
- link to official `pyspelling` docs.

Closes #18736

6 weeks agosocks: handle error in verbose trace gracefully
Stefan Eissing [Thu, 25 Sep 2025 10:00:57 +0000 (12:00 +0200)] 
socks: handle error in verbose trace gracefully

Adjust the flow to always succeed in verbose trace of connect.

Reported in Joshua's sarif data

Closes #18722

6 weeks agotftp: only check address if it was stored
Daniel Stenberg [Thu, 25 Sep 2025 14:19:56 +0000 (16:19 +0200)] 
tftp: only check address if it was stored

If recvfrom() fails, it might not have stored an address.

Follow-up to c4f9977c66bbb05a837a7eb03004dd79c3cc9b44

Pointed out by CodeSonar

Closes #18738

6 weeks agoschannel_verify: use more human friendly error messages
Daniel Stenberg [Thu, 25 Sep 2025 12:52:38 +0000 (14:52 +0200)] 
schannel_verify: use more human friendly error messages

Closes #18737

6 weeks agoGHA: set `HOMEBREW_NO_AUTO_UPDATE=1` for Linuxbrew
Viktor Szakats [Thu, 25 Sep 2025 12:38:48 +0000 (14:38 +0200)] 
GHA: set `HOMEBREW_NO_AUTO_UPDATE=1` for Linuxbrew

In an attempt to make `brew install` commands initialize faster.

Often this command started with 20-50 seconds of delay before this
patch. This is an attempt to make it launch faster.

Cherry-picked from #18736

6 weeks agoGHA/checksrc: drop no longer used `DEBIAN_FRONTEND` env
Viktor Szakats [Thu, 25 Sep 2025 12:34:46 +0000 (14:34 +0200)] 
GHA/checksrc: drop no longer used `DEBIAN_FRONTEND` env

Follow-up to 7d5f8be532c19ec73063aaa4f27057047bdae5ac #18708
Cherry-picked from #18736

6 weeks agoKNOWN_BUGS: telnet code does not handle partial writes properly
Daniel Stenberg [Thu, 25 Sep 2025 11:40:54 +0000 (13:40 +0200)] 
KNOWN_BUGS: telnet code does not handle partial writes properly

Reported in Joshua's sarif data

Closes #18735

6 weeks agoGHA: bump pip `cryptography`, relax `impacket` version requirement
Viktor Szakats [Thu, 25 Sep 2025 11:14:36 +0000 (13:14 +0200)] 
GHA: bump pip `cryptography`, relax `impacket` version requirement

Bump `cryptography` to a newer version that fixes two known OpenSSL
vulnerabilities reported by Dependabot.

To make it work, also allow `impacket` 0.11.0, because it allows any
pyOpenSSL version, while 0.12.0 pinned it to a single version that
happens to be incompatible with the bugfixed `cryptography` version.

Also: drop spaces from `requirements.txt` files. Bots don't add them,
though they seem to be preferred in the official documentation:
https://pip.pypa.io/en/stable/reference/requirements-file-format/

https://github.com/fortra/impacket/blob/impacket_0_11_0/requirements.txt
https://github.com/fortra/impacket/blob/impacket_0_12_0/requirements.txt

Follow-up to 7d5f8be532c19ec73063aaa4f27057047bdae5ac #18708

Closes #18731

6 weeks agoopenssl: set io_need always
Stefan Eissing [Thu, 25 Sep 2025 11:31:17 +0000 (13:31 +0200)] 
openssl: set io_need always

When OpenSSL reports SSL_ERROR_WANT_READ, set the io_need explicitly.
It should have already been set by the BIO, but be safe.

Reported in Joshua's sarif data

Closes #18733

6 weeks agotransfer: avoid busy loop with tiny speed limit
Stefan Eissing [Thu, 25 Sep 2025 11:25:29 +0000 (13:25 +0200)] 
transfer: avoid busy loop with tiny speed limit

When a transfer has a speed limit less than 4, the receive loop early
exits without receiving anything, causing a busy loop for that transfer.

Perform that check only after the first receive has been done.

Reported in Joshua's sarif data

Closes #18732

6 weeks agoquiche: when ingress processing fails, return that error code
Stefan Eissing [Thu, 25 Sep 2025 11:17:48 +0000 (13:17 +0200)] 
quiche: when ingress processing fails, return that error code

Instead of a general CURLE_RECV_ERROR.

Reported in Joshua's sarif data

Closes #18730

6 weeks agowolfssl: fix error check in shutdown
Stefan Eissing [Thu, 25 Sep 2025 11:11:58 +0000 (13:11 +0200)] 
wolfssl: fix error check in shutdown

When trying to send the TLS shutdown, use the return code
to check for the cause.

Reported in Joshua's sarif data

Closes #18729

6 weeks agorustls: fix comment describing cr_recv()
Stefan Eissing [Thu, 25 Sep 2025 10:59:36 +0000 (12:59 +0200)] 
rustls: fix comment describing cr_recv()

The comments on `cf_recv()` function were outdated and described
calling conventions that no longer are true.

Reported in Joshua's sarif data

Closes #18728

6 weeks agombedtls: check result of setting ALPN
Stefan Eissing [Thu, 25 Sep 2025 10:53:37 +0000 (12:53 +0200)] 
mbedtls: check result of setting ALPN

The result of setting the negotiated ALPN was not checked, leading
to reporting success when it should not have.

Reported in Joshua's sarif data

Closes #18727

6 weeks agoquiche: fix verbose message when ip quadruple cannot be obtained.
Stefan Eissing [Thu, 25 Sep 2025 10:46:09 +0000 (12:46 +0200)] 
quiche: fix verbose message when ip quadruple cannot be obtained.

Reported in Joshua's sarif data

Closes #18726

6 weeks agoopenssl-quic: handle error in SSL_get_stream_read_error_code
Stefan Eissing [Thu, 25 Sep 2025 10:38:02 +0000 (12:38 +0200)] 
openssl-quic: handle error in SSL_get_stream_read_error_code

The return code of SSL_get_stream_read_error_code() was not checked
in one location, but others. Make that consistent.

Reported in Joshua's sarif data

Closes #18725

6 weeks agoopenssl: clear retry flag on x509 error
Stefan Eissing [Thu, 25 Sep 2025 10:11:15 +0000 (12:11 +0200)] 
openssl: clear retry flag on x509 error

When loading the trust anchors and encountering an error, clear
a possibly set retry flag.

Reported in Joshua's sarif data

Closes #18724

6 weeks agongtcp2: fix early return
Stefan Eissing [Thu, 25 Sep 2025 10:07:25 +0000 (12:07 +0200)] 
ngtcp2: fix early return

On a failed tls handshake, the receive function returned without
restoring the current data.

Reported in Joshua's sarif data

Closes #18723

6 weeks agoopenssl-quic: check results better
Stefan Eissing [Thu, 25 Sep 2025 09:49:45 +0000 (11:49 +0200)] 
openssl-quic: check results better

Fail on errors from SSL_handle_events().
Force quit Caddy test instance that is left hanging longer with
openssl-quic tests for unknown reasons.

Reported in Joshua's sarif data

Closes #18720

6 weeks agowolfssl: check BIO read parameters
Stefan Eissing [Thu, 25 Sep 2025 09:25:17 +0000 (11:25 +0200)] 
wolfssl: check BIO read parameters

Check parameters passed more thoroughly and assure that current 'data'
also exists.

Reported in Joshua's sarif data

Closes #18718

6 weeks agovtls: alpn setting, check proto parameter
Stefan Eissing [Thu, 25 Sep 2025 09:15:15 +0000 (11:15 +0200)] 
vtls: alpn setting, check proto parameter

When setting the negotiated alpn protocol, either then length
must be 0 or a pointer must be passed.

Reported in Joshua's sarif data

Closes #18717

6 weeks agosocks: rewwork, cleaning up socks state handling
Stefan Eissing [Tue, 26 Aug 2025 13:54:32 +0000 (15:54 +0200)] 
socks: rewwork, cleaning up socks state handling

Restructured the code in the following ways:

* add terminal states SUCCESS and FAILED
* split SOCK4 and SOCK5 states to be more clear
* use `bufq` for send/recv of SOCK messages
* reduce SOCKS4 states, more speaking names
* for most states, move code into static function
* reduce SOCKS5 states, more speaking names
* add helpers for traversing to FAILED state
* add helper to flush bufq
* add hepler to read minimum amount into bufq

Closes #18401

6 weeks agolib: upgrade/multiplex handling
Stefan Eissing [Fri, 8 Aug 2025 10:15:25 +0000 (12:15 +0200)] 
lib: upgrade/multiplex handling

Improvements around HTTP Upgrade: and multiplex hanndling:

* add `Curl_conn_set_multiplex()` to set connection's multiplex
  bit and trigger "connchanged" events
* call `Curl_conn_set_multiplex()` in filters' `CF_CTRL_CONN_INFO_UPDATE`
  implementation where other connection properties are updated.
  This prevents connection updates before the final filter chain
  is chosen.
* rename enum `UPGR101_INIT` to `UPGR101_NONE`
* rename connection bit `asks_multiplex` to `upgrade_in_progress`
* trigger "connchanged" when `upgrade_in_progress` clears
* rename `WebSockets` to `WebSocket` as it is the common term
  used in documentation

Closes #18227

6 weeks agosocks_sspi: bail out on too long fields
Daniel Stenberg [Thu, 25 Sep 2025 09:30:24 +0000 (11:30 +0200)] 
socks_sspi: bail out on too long fields

A probably unnecessary precaution but since the field sizes are 16 bit in the
protocol this makes sure to fail if they would ever be larger as that would go
wrong.

Reported in Joshua's sarif data

Closes #18719

6 weeks agoGHA/checksrc: run `reuse` directly, merge into the linters workflow
Viktor Szakats [Thu, 25 Sep 2025 09:53:47 +0000 (11:53 +0200)] 
GHA/checksrc: run `reuse` directly, merge into the linters workflow

To eliminate dependencies on an Action, Docker Hub and to simplify.

Closes #18721

6 weeks agoGHA: update dependency ruff to v0.13.1
renovate[bot] [Thu, 25 Sep 2025 08:48:20 +0000 (08:48 +0000)] 
GHA: update dependency ruff to v0.13.1

6 weeks agosocks_gssapi: remove superfluous releases of the gss_recv_token
Daniel Stenberg [Thu, 25 Sep 2025 08:35:40 +0000 (10:35 +0200)] 
socks_gssapi: remove superfluous releases of the gss_recv_token

Reported in Joshua's sarif data

Closes #18714

6 weeks agocf-h2-proxy: break loop on edge case
Stefan Eissing [Thu, 25 Sep 2025 08:42:24 +0000 (10:42 +0200)] 
cf-h2-proxy: break loop on edge case

nghttp2 always consumes the memory, but be safe in case it ever decideds
to not to.

Fixes J2
Reported in Joshua's sarif data
Closes #18715

6 weeks agoGHA: use pip `requirements.txt` with pins, and more venv
Viktor Szakats [Wed, 24 Sep 2025 15:22:52 +0000 (17:22 +0200)] 
GHA: use pip `requirements.txt` with pins, and more venv

- requirements.txt: shorten copyright headers.

- requirements.txt: pin packages to versions.

- GHA/windows: use `tests/requirements.txt`.
  Pick a `cryptography` package version that satifies both `impacket`
  and pytests dependencies.

- GHA/checksrc: move pip deps into a new `requirements.txt`.
  To make Dependabot detect and bump them.

- GHA/checksrc: replace apt packages for python test deps with pip
  install `tests/**/requirements.txt` to a venv.

- GHA/checksrc: use venv and drop `--break-system-packages`.

- GHA/linux: fix to actually activate venvs.
  Follow-up to 2638570241cb9e68240d7621f0213916334a4765 #15578

- GHA/linux: fixup (did not cause an issue)
  Follow-up to d75785c7dea214d12525beb659694d3fcc483731 #18660

- GHA: create venvs later, simplify commands.

- GHA: sync pip command-line options, e.g. drop progress-bar,
  everywhere.

Assisted-by: Dan Fandrich
Closes #18708

6 weeks agoOS400: fix a use-after-free/double-free case
Patrick Monnerat [Wed, 24 Sep 2025 23:14:19 +0000 (01:14 +0200)] 
OS400: fix a use-after-free/double-free case

Closes #18713

6 weeks agosocks_gssapi: remove the forced "no protection"
Daniel Stenberg [Sun, 21 Sep 2025 21:34:37 +0000 (23:34 +0200)] 
socks_gssapi: remove the forced "no protection"

If a protected connection is requested, don't claim to drop down to "no
protection".

Reported in Joshua's sarif data

Closes #18712

6 weeks agosocks_gssapi: make the gss_context a local variable
Daniel Stenberg [Thu, 25 Sep 2025 06:45:53 +0000 (08:45 +0200)] 
socks_gssapi: make the gss_context a local variable

Reported-by: Stanislav Fort
Closes #18711

6 weeks agombedtls: handle WANT_WRITE from mbedtls_ssl_read()
Daniel Stenberg [Mon, 22 Sep 2025 09:27:27 +0000 (11:27 +0200)] 
mbedtls: handle WANT_WRITE from mbedtls_ssl_read()

The mbedtls_ssl_read() function is documented to be able to also return
MBEDTLS_ERR_SSL_WANT_WRITE, so act on that accordingly instead of
returning error for it.

Assisted-by: Stefan Eissing
Reported in Joshua's sarif data
Closes #18682

6 weeks agoKNOWN_BUGS: Access violation sending client cert with SChannel
Daniel Stenberg [Mon, 22 Sep 2025 08:09:18 +0000 (10:09 +0200)] 
KNOWN_BUGS: Access violation sending client cert with SChannel

It seems we can select between crashing or leaking sensitive files
because Schannel is buggy.

Closes #17626
Closes #18679

6 weeks agoGHA: update actions/cache digest to 0057852
renovate[bot] [Wed, 24 Sep 2025 21:01:05 +0000 (21:01 +0000)] 
GHA: update actions/cache digest to 0057852

Closes #18710

6 weeks agoRELEASE-NOTES: codespell
Viktor Szakats [Wed, 24 Sep 2025 21:48:13 +0000 (23:48 +0200)] 
RELEASE-NOTES: codespell

6 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 24 Sep 2025 21:03:03 +0000 (23:03 +0200)] 
RELEASE-NOTES: synced

6 weeks agovssh: drop support for wolfSSH
Daniel Stenberg [Wed, 24 Sep 2025 04:52:52 +0000 (06:52 +0200)] 
vssh: drop support for wolfSSH

The implementation was incomplete and lesser than the other backends. No
one ever reported a bug or requested enhancements for this, indicating
that this backend was never used.

Closes #18700

6 weeks agoGHA/curl-for-win: use `DOCKER_IMAGE_STABLE`
Viktor Szakats [Wed, 24 Sep 2025 15:44:47 +0000 (17:44 +0200)] 
GHA/curl-for-win: use `DOCKER_IMAGE_STABLE`

Replacing the hard-wired stable image. After this patch, it
will automatically follow upstream updates.

Follow-up to https://github.com/curl/curl-for-win/commit/6870bc1b35baff03168af1d0506ec8610851a819
Follow-up to https://github.com/curl/curl-for-win/commit/5a25df253da4f68de52b14a2e612df5fc60b8aa6

Closes #18709

6 weeks agodocs: fix/tidy code fences
Viktor Szakats [Wed, 24 Sep 2025 12:53:18 +0000 (14:53 +0200)] 
docs: fix/tidy code fences

- INSTALL.md: fence code to avoid wrong rendering.
Reported-by: rinsuki on github
Fixes: https://github.com/curl/curl-www/issues/480
- use `sh` instead of `bash` as fence language, for less visual noise.

- INSTALL.md: drop stray shebang.

- ECH.md: drop indent from fenced code.

- minor tidy-ups.

Ref: https://curl.se/docs/install.html

Closes #18707

6 weeks agohostip: remove unnecessary leftover INT_MAX check in Curl_dnscache_prune
Daniel Stenberg [Mon, 22 Sep 2025 08:30:15 +0000 (10:30 +0200)] 
hostip: remove unnecessary leftover INT_MAX check in Curl_dnscache_prune

The math already uses timediff_t so no need for the extra logic

Ref: #18678
Closes #18680

6 weeks agoRevert "cf_socket_recv: don't count reading zero bytes as first byte"
Daniel Stenberg [Mon, 22 Sep 2025 07:10:39 +0000 (09:10 +0200)] 
Revert "cf_socket_recv: don't count reading zero bytes as first byte"

This reverts commit df60e8fe701e189e7629fd08b61950a0fb1b697a.

The "first byte" checkpoint is not strictly the first byte received, but
the sign of first traffic from the server, which a closed connection
also is.

Closes #18676

6 weeks agosocks_gssapi: reject too long tokens
Daniel Stenberg [Mon, 22 Sep 2025 09:08:43 +0000 (11:08 +0200)] 
socks_gssapi: reject too long tokens

If GSS returns a token to use that is longer than 65535 bytes, it can't
be transmitted since the length field is an unisgned 16 bit field and
thus needs to trigger an error.

Reported in Joshua's sarif data

Closes #18681

6 weeks agoares: fix leak in tracing
Stefan Eissing [Tue, 23 Sep 2025 07:55:11 +0000 (09:55 +0200)] 
ares: fix leak in tracing

When DNS tracing is enabled, a string allocated by ares was not freed.

Reported-by: jmaggard10 on github
Bug: https://github.com/curl/curl/pull/18251#pullrequestreview-3255785083
Closes #18691

6 weeks agoGHA: Update ngtcp2/ngtcp2 to v1.16.0
renovate[bot] [Wed, 24 Sep 2025 09:26:25 +0000 (09:26 +0000)] 
GHA: Update ngtcp2/ngtcp2 to v1.16.0

Closes #18706

6 weeks agoGHA: update ngtcp2/nghttp3 to v1.12.0
renovate[bot] [Wed, 24 Sep 2025 09:26:19 +0000 (09:26 +0000)] 
GHA: update ngtcp2/nghttp3 to v1.12.0

Closes #18705

6 weeks agoGHA/distcheck: bump timeout for the cmake integration
Viktor Szakats [Wed, 24 Sep 2025 08:16:05 +0000 (10:16 +0200)] 
GHA/distcheck: bump timeout for the cmake integration

It may take 1.5 minutes to find the C compiler on macos with old cmake.
The build is also slow due to no unity and Ninja support.

```
Wed, 24 Sep 2025 04:56:51 GMT -- Using CMake version 3.11.4
Wed, 24 Sep 2025 04:58:01 GMT -- The C compiler identification is AppleClang 17.0.0.17000013
Wed, 24 Sep 2025 04:58:02 GMT -- Check for working C compiler: /Applications/Xcode_16.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Wed, 24 Sep 2025 04:59:33 GMT -- Check for working C compiler: /Applications/Xcode_16.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
Wed, 24 Sep 2025 04:59:33 GMT -- Detecting C compiler ABI info
Wed, 24 Sep 2025 04:59:35 GMT -- Detecting C compiler ABI info - done
```
Ref: https://github.com/curl/curl/actions/runs/17966736478/job/51100678487?pr=18700#step:10:50

Closes #18702

6 weeks agoGHA/dist: fix number of parallel jobs on macos runner
Viktor Szakats [Wed, 24 Sep 2025 08:29:30 +0000 (10:29 +0200)] 
GHA/dist: fix number of parallel jobs on macos runner

It was using the global parallel value in cmake integration tests, while
on macos runners, this should be lower by one, as used in other macos
jobs. Performance impact is minimal.

Follow-up to fb70812437ad28b74dbdc1031e46c1d86bc9db3c #16126
Closes #18701

6 weeks agoGHA: update dependency awslabs/aws-lc to v1.61.3
renovate[bot] [Mon, 22 Sep 2025 22:35:46 +0000 (22:35 +0000)] 
GHA: update dependency awslabs/aws-lc to v1.61.3

Closes #18690

6 weeks agoGHA/macos: add macos-26, llvm20, gcc15, drop macos-14, gcc14
Viktor Szakats [Tue, 23 Sep 2025 13:45:49 +0000 (15:45 +0200)] 
GHA/macos: add macos-26, llvm20, gcc15, drop macos-14, gcc14

Number of combo jobs down to 22 from 24.

Also:
- update the version matrix.
- update exclusion matrix.
- include verbose compiler configuration dump.
  It makes the Apple-included, default `-I/usr/local/include` visible.
  Ref: #18683

Closes #18698

6 weeks agoGHA/linux: enable libidn2 and libssh in asan job
Viktor Szakats [Tue, 23 Sep 2025 10:47:45 +0000 (12:47 +0200)] 
GHA/linux: enable libidn2 and libssh in asan job

Closes #18697

6 weeks agoGHA/linux: fix address sanitizer error output
Viktor Szakats [Tue, 23 Sep 2025 09:50:23 +0000 (11:50 +0200)] 
GHA/linux: fix address sanitizer error output

Same issue as seen earlier in the tsan job. Fix it the same way, by
switching to cmake to avoid autotools' libtool confusing the analyzer.
Ref: 2a46df31fdb91851895bc46d81f0065e6cafc80b #18274

Configuration remains identical. I removed libssh2 from the installed
packages, because it was unused before, but cmake enabled it by default
and libssh2 has memory leaks:
Ref: https://github.com/curl/curl/actions/runs/17941312820/job/51018425159

Fixing:
```
/usr/bin/llvm-symbolizer-18: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: no version information available (required by /usr/bin/llvm-symbolizer-18)
/usr/bin/llvm-symbolizer-18: symbol lookup error: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: undefined symbol: __asan_option_detect_stack_use_after_return
==33900==WARNING: Can't read from symbolizer at fd 3
[..]
==33900==WARNING: Can't write to symbolizer at fd 6
==33900==WARNING: Failed to use and restart external symbolizer
```
Ref: https://github.com/curl/curl/actions/runs/17939949191/job/51013953675?pr=18693

Cherry-picked from #18693
Closes #18696

6 weeks agoGHA/codeql: build `units` on Linux
Viktor Szakats [Tue, 23 Sep 2025 09:19:18 +0000 (11:19 +0200)] 
GHA/codeql: build `units` on Linux

Closes #18695

6 weeks agotidy-up: URLs
Viktor Szakats [Mon, 22 Sep 2025 21:58:41 +0000 (23:58 +0200)] 
tidy-up: URLs

Closes #18689

6 weeks agocmake: use modern alternatives for `get_filename_component()`
Viktor Szakats [Mon, 22 Sep 2025 16:02:49 +0000 (18:02 +0200)] 
cmake: use modern alternatives for `get_filename_component()`

- use `cmake_path()` to query filenames, with CMake 3.20 or upper.
  https://cmake.org/cmake/help/v4.1/command/cmake_path.html#query

- use `cmake_host_system_information()` to query the registry,
  with CMake 3.24 or upper.
  https://cmake.org/cmake/help/v4.1/command/cmake_host_system_information.html#query-windows-registry
  Replacing the undocumented method.

- also quote the value passed to `get_filename_component()` where
  missing. (Could not cause an actual issue as used in the code.)

Closes #18688

6 weeks agoGHA: enable more options in static analyzer jobs
Viktor Szakats [Sat, 20 Sep 2025 09:43:59 +0000 (11:43 +0200)] 
GHA: enable more options in static analyzer jobs

This is an effort to pass more code through clang-tidt and scan-build
static analyzers. Following CodeQL Linux jobs.

GHA/codeql:
- also build with libssh.
- disable verbose output in build steps.

GHA/linux:
- enable more build options for the clang-tidy and scan-build jobs:
  libidn2, nghttp2, ldap, kerberos, rtmp, gnutls, gsasl, rustls,
  mbedtls, wolfssl
  Use Linuxbrew where necessary.
- also enable ECH, gssapi in the scan-build job.
- fix 'scanbuild' to be 'scan-build' in the job name.

GHA/macos:
- build with Rustls in the clang-tidy job.
- add a new clang-tidy job to test HTTP/3 (with openssl + ngtcp2).
- build with libssh in one of the clang-tidy jobs.
- build with LibreSSL in the MultiSSL clang-tidy job.
- build with heimdal and kerberos in the clang-tidy jobs respectively.
- build with OpenLDAP in one clang-tidy job.
- add support for `skipall`, `skiprun` job options, and use it.

Closes #18660

6 weeks agolibssh: drop two unused assigments
Viktor Szakats [Mon, 22 Sep 2025 09:27:10 +0000 (11:27 +0200)] 
libssh: drop two unused assigments

Reported in macOS clang-tidy v21.1.1 build, after enabling libssh in it:
```
lib/vssh/libssh.c
lib/vssh/libssh.c:1342:9: error: Value stored to 'to_t' is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors]
 1342 |         to_t = STRE_OK;
      |         ^
lib/vssh/libssh.c:1342:9: note: Value stored to 'to_t' is never read
lib/vssh/libssh.c:1349:9: error: Value stored to 'from_t' is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors]
 1349 |         from_t = STRE_OK;
      |         ^
lib/vssh/libssh.c:1349:9: note: Value stored to 'from_t' is never read
2 warnings generated.
```
Ref: https://github.com/curl/curl/actions/runs/17909917954/job/50918955923?pr=18660#step:11:182

Cherry-picked from #18660
Closes #18684

6 weeks agoGHA/linux: install zlib in all jobs by default
Viktor Szakats [Sun, 21 Sep 2025 17:48:22 +0000 (19:48 +0200)] 
GHA/linux: install zlib in all jobs by default

Cherry-picked from #18660
Closes #18672

6 weeks agoautotools: capitalize 'Rustls' in the log output
Viktor Szakats [Mon, 22 Sep 2025 00:03:08 +0000 (02:03 +0200)] 
autotools: capitalize 'Rustls' in the log output

To match the rest of the codebase.

Follow-up to 548d8a842123c854ba92aac90a24c6191e2a8bd4
Cherry-picked from #18660
Closes #18671

6 weeks agorustls: fix clang-tidy warning
Viktor Szakats [Sun, 21 Sep 2025 19:55:30 +0000 (21:55 +0200)] 
rustls: fix clang-tidy warning

Seen with v21.1.1, non-debug-enabled build:
```
lib/vtls/rustls.c:415:23: error: File position of the stream might be 'indeterminate'
after a failed operation. Can cause undefined behavior [clang-analyzer-unix.Stream,-warnings-as-errors]
  415 |     const size_t rr = fread(buf, 1, sizeof(buf), f);
      |                       ^
```
Ref: https://github.com/curl/curl/actions/runs/17898248031/job/50887746633?pr=18660#step:11:174

Cherry-picked from #18660
Closes #18670

6 weeks agotool_doswin: fix to use curl socket functions
Viktor Szakats [Sat, 20 Sep 2025 11:34:08 +0000 (13:34 +0200)] 
tool_doswin: fix to use curl socket functions

Replace `WSASocketW()` with `CURL_SOCKET()`. Also replace a call
to `socketclose()` with `sclose()`. According to a comment,
`socketclose()` was chosen to silence test 1498 (and 2300) reporting
`MEMORY FAILURE`. These reports were accurate, and were caused by
calling `WSASocketW()` instead of `socket()` (now `CURL_SOCKET()`).

This also fixes the curl `sclose()` call on an error branch, which is
now correctly paired with a curl socket open. The mismatched open/close
calls caused an issue in TrackMemory-enabled (aka `CURLDEBUG`) builds.

Docs confirm that `socket()` is defaulting to overlapped I/O, matching
the replaced `WSASocketW()` call:
https://learn.microsoft.com/windows/win32/api/winsock2/nf-winsock2-socket#remarks

Also:
- checksrc: ban `WSASocket*()` functions.
- report `SOCKERRNO` instead of `GetLastError()` for socket calls,
  to match the rest of the codebase.

Follow-up to 9a2663322c330ff11275abafd612e9c99407a94a #17572

Closes #18633

6 weeks agomanagen: strict protocol check
Daniel Stenberg [Mon, 22 Sep 2025 06:33:20 +0000 (08:33 +0200)] 
managen: strict protocol check

- protocols MUST match one in the accept-list
- protocols are typically all uppercase
- drop All
- use SCP and SFTP instead of SSH
- add Protocols: to some options previously missing one

Closes #18675

6 weeks agotftp: pin the first used address
Daniel Stenberg [Sun, 21 Sep 2025 09:07:31 +0000 (11:07 +0200)] 
tftp: pin the first used address

Store the used remote address on the first receive call and then make
sure that it remains the same address on subsequent calls to reduce the
risk of tampering. Doesn't make the transfer secure because it is still
unauthenticated and clear text.

Reported in Joshua's sarif data

Closes #18658

6 weeks agotelnet: refuse IAC codes in content
Daniel Stenberg [Sun, 21 Sep 2025 08:48:00 +0000 (10:48 +0200)] 
telnet: refuse IAC codes in content

Ban the use of IAC (0xff) in telnet options set by the application. They
need to be escaped when sent but I can't see any valid reason for an
application to send them.

Of course, an application sending such data basically ask for trouble.

Reported in Joshua's sarif data

Closes #18657

6 weeks agoautotools: add support for libgsasl auto-detection via pkg-config
Viktor Szakats [Sun, 21 Sep 2025 18:25:04 +0000 (20:25 +0200)] 
autotools: add support for libgsasl auto-detection via pkg-config

Enable with `--with-gsasl`, as before.

Cherry-picked from #18660
Closes #18669

6 weeks agoautotools: fix duplicate `UNIX` and `BSD` flags in `buildinfo.txt`
Viktor Szakats [Sun, 21 Sep 2025 16:02:21 +0000 (18:02 +0200)] 
autotools: fix duplicate `UNIX` and `BSD` flags in `buildinfo.txt`

Follow-up to 2a292c39846107228201674d686be5b3ed96674d #15975

Closes #18667

6 weeks agoautotools: fix silly mistake in clang detection for `buildinfo.txt`
Viktor Szakats [Sun, 21 Sep 2025 15:51:34 +0000 (17:51 +0200)] 
autotools: fix silly mistake in clang detection for `buildinfo.txt`

Follow-up to 0513f9f8786e0cc4246e05d56bd264d0292d9c92 #18645

Closes #18666

6 weeks agotidy-up: assortment of small fixes
Viktor Szakats [Thu, 21 Aug 2025 20:27:41 +0000 (22:27 +0200)] 
tidy-up: assortment of small fixes

- examples/headerapi: fix wrong cast.
- curl_ngtcp2: delete stray character from error message.
- rustls: fix inline variable declaration.
- sendf: drop redundant `int` cast.
- libtest/cli_ws_data: drop cast with mismatched signedness.

Cherry-picked from #18343

Closes #18664

6 weeks agocmake: clang detection tidy-ups
Viktor Szakats [Sun, 21 Sep 2025 11:31:35 +0000 (13:31 +0200)] 
cmake: clang detection tidy-ups

Follow-up to 0513f9f8786e0cc4246e05d56bd264d0292d9c92 #18645
Follow-up to fe5225b5eaf3a1a0ce149023d38a9922a114798b #18209

Closes #18659

6 weeks agoGHA/codeql: enable ECH and HTTPS-RR
Viktor Szakats [Sat, 20 Sep 2025 09:35:01 +0000 (11:35 +0200)] 
GHA/codeql: enable ECH and HTTPS-RR

Switch to Linuxbrew c-ares to hit the minimum version.
(Ubuntu offers 1.27.0, HTTPS-RR requires 1.28.0.)

Closes #18661

6 weeks agows: reject curl_ws_recv called with NULL buffer with a buflen
Daniel Stenberg [Sun, 21 Sep 2025 08:18:13 +0000 (10:18 +0200)] 
ws: reject curl_ws_recv called with NULL buffer with a buflen

Arguably this is just a bad application.

Reported in Joshua's sarif data

Closes #18656

6 weeks agoopenldap: check ldap_get_option() return codes
Daniel Stenberg [Sat, 20 Sep 2025 21:53:52 +0000 (23:53 +0200)] 
openldap: check ldap_get_option() return codes

Do not just assume that they always work.

Reported in Joshua's sarif data

Closes #18653

6 weeks agolibssh: fix range parsing error handling mistake
Daniel Stenberg [Sat, 20 Sep 2025 21:38:04 +0000 (23:38 +0200)] 
libssh: fix range parsing error handling mistake

The range-parsing returned CURLE_RANGE_ERROR directly on one error
instead of calling myssh_to_ERROR() like it should and like it does for
all other errors.

Reported in Joshua's sarif data

Closes #18652

6 weeks agorustls: use %zu for size_t in failf() format string
Daniel Stenberg [Sat, 20 Sep 2025 21:33:05 +0000 (23:33 +0200)] 
rustls: use %zu for size_t in failf() format string

Reported in Joshua's sarif data

Closes #18651

6 weeks agoftp: fix ftp_do_more returning with *completep unset
Daniel Stenberg [Sat, 20 Sep 2025 21:23:07 +0000 (23:23 +0200)] 
ftp: fix ftp_do_more returning with *completep unset

Specifically, when ftpc->wait_data_conn was true and
Curl_conn_connect(...) returned with serv_conned == false the code
called ftp_check_ctrl_on_data_wait and returned without setting
*completep.

Now set it to 0 at function start to avoid this happening again.

Reported in Joshua's sarif data

Closes #18650

6 weeks agotelnet: return error on crazy TTYPE or XDISPLOC lengths
Daniel Stenberg [Sat, 20 Sep 2025 20:55:50 +0000 (22:55 +0200)] 
telnet: return error on crazy TTYPE or XDISPLOC lengths

Also use the packet size msnprintf() stores instead of calculating it
separately.

Reported in Joshua's sarif data

Closes #18648