]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 months 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

2 months 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

2 months 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

2 months 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

2 months 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

2 months 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

2 months 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

2 months 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

2 months 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

2 months 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

2 months 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

2 months 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

2 months 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

2 months agovtls_int.h: clarify data_pending
Daniel Stenberg [Sat, 20 Sep 2025 15:44:32 +0000 (17:44 +0200)] 
vtls_int.h: clarify data_pending

Suggested-by: Joseph Birr-Pixton
Closes #18644

2 months agows: clarify an error message
Daniel Stenberg [Sat, 20 Sep 2025 22:09:09 +0000 (00:09 +0200)] 
ws: clarify an error message

Instead of:

 "[WS] frame length longer than 64 signed not supported"

Use:

 "[WS] frame length longer than 63 bit not supported"

Closes #18654

2 months agoRELEASE-NOTES: spellcheck!
Daniel Stenberg [Sun, 21 Sep 2025 07:39:58 +0000 (09:39 +0200)] 
RELEASE-NOTES: spellcheck!

2 months agobuild: show llvm/clang in platform flags and `buildinfo.txt`
Viktor Szakats [Sat, 20 Sep 2025 17:04:21 +0000 (19:04 +0200)] 
build: show llvm/clang in platform flags and `buildinfo.txt`

Show these flags:
- `LLVM-CLANG` for mainline llvm/clang.
- `APPLE-CLANG` for Apple clang.
- `CLANG-CL` for clang-cl. (cmake only)

Also:
- GHA/linux: fix a job to build with clang, to match its descriptions.

Closes #18645

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Sat, 20 Sep 2025 22:05:55 +0000 (00:05 +0200)] 
RELEASE-NOTES: synced

2 months agowrite-out: make %header{} able to output *all* occurances of a header
Daniel Stenberg [Sun, 7 Sep 2025 22:18:52 +0000 (00:18 +0200)] 
write-out: make %header{} able to output *all* occurances of a header

By appending `:all:[separator]` to the header name. The `[separator]` string
is output between each header value if there are more than one to output.

Test 764 and 765 verify

Idea-by: kapsiR on github
Ref: #18449
Closes #18491

2 months agokrb5: drop support for Kerberos FTP
Daniel Stenberg [Wed, 17 Sep 2025 06:32:39 +0000 (08:32 +0200)] 
krb5: drop support for Kerberos FTP

It was accidentally broken in commit 0f4c439fc7347f499cf5, shipped since
8.8.0 (May 2024) and yet not a single person has noticed or reported,
indicating that we might as well drop support for FTP Kerberos.

Krb5 support was added in 54967d2a3ab55596314 (July 2007), and we have
been carrying the extra license information around since then for this
code. This commit removes the last traces of that code and thus we can
remove the extra copyright notices along with it.

Reported-by: Joshua Rogers
Closes #18577

2 months agoopenssl: make the asn1_object_dump name null terminated
Daniel Stenberg [Sat, 20 Sep 2025 20:49:46 +0000 (22:49 +0200)] 
openssl: make the asn1_object_dump name null terminated

In case the buffer is too small.

Reported in Joshua's sarif data

Closes #18647

2 months agolibssh2: up the minimum requirement to 1.9.0
Daniel Stenberg [Fri, 19 Sep 2025 07:32:42 +0000 (09:32 +0200)] 
libssh2: up the minimum requirement to 1.9.0

Released on June 20 2019

2 months agohttpsrr: free old pointers when storing new
Daniel Stenberg [Sat, 20 Sep 2025 10:12:02 +0000 (12:12 +0200)] 
httpsrr: free old pointers when storing new

In case we get "funny" input and the same field is provided several
times, free the old pointer before stored a new memdup.

Reported in Joshua's sarif data

Closes #18631

2 months agoopenldap: improve check for receiving blank data
Daniel Stenberg [Sat, 20 Sep 2025 10:21:26 +0000 (12:21 +0200)] 
openldap: improve check for receiving blank data

It can't access the first byte either unless it has length.

Followup to 232d5a2ed9c091c88e3b724a1e7d6

Closes #18632

2 months agotftp: return error when sendto() fails
Daniel Stenberg [Sat, 20 Sep 2025 15:40:17 +0000 (17:40 +0200)] 
tftp: return error when sendto() fails

The code just called failf() and then continued without returning error.

Reported in Joshua's sarif data

Closes #18643

2 months agolibssh: return out of memory correctly if aprintf fails
Daniel Stenberg [Sat, 20 Sep 2025 12:51:01 +0000 (14:51 +0200)] 
libssh: return out of memory correctly if aprintf fails

The code called set sshc->nextstate and returned SSH_OK without setting
sshc->actualcode to an error code.

Reported in Joshua's sarif data

Closes #18637

2 months agocf-socket: use the right byte order for ports in bindlocal
Daniel Stenberg [Sat, 20 Sep 2025 14:56:14 +0000 (16:56 +0200)] 
cf-socket: use the right byte order for ports in bindlocal

Reported in Joshua's sarif data

Closes #18641

2 months agoschannel: assign result before using it
Daniel Stenberg [Sat, 20 Sep 2025 15:14:10 +0000 (17:14 +0200)] 
schannel: assign result before using it

curl_easy_strerror(result) was called *before* result was assigned.

Reported in Joshua's sarif data

Closes #18642

2 months agoCURLOPT_HEADER/WRITEFUNCTION.md: drop '* size' since size is always 1
Daniel Stenberg [Sat, 20 Sep 2025 14:47:16 +0000 (16:47 +0200)] 
CURLOPT_HEADER/WRITEFUNCTION.md: drop '* size' since size is always 1

Closes #18640

2 months agolibssh: error on bad chown number and store the value
Daniel Stenberg [Sat, 20 Sep 2025 13:00:37 +0000 (15:00 +0200)] 
libssh: error on bad chown number and store the value

To avoid continuing with an unintended zero uid. Also actually use the
value, which was omitted before!

Reported in Joshua's sarif data

Closes #18639

2 months agotftp: handle tftp_multi_statemach() return code
Daniel Stenberg [Sat, 20 Sep 2025 12:56:03 +0000 (14:56 +0200)] 
tftp: handle tftp_multi_statemach() return code

Previously just ignored.

Reported in Joshua's sarif data

Closes #18638

2 months agoftp: fix port number range loop for PORT commands
Daniel Stenberg [Sat, 20 Sep 2025 12:45:47 +0000 (14:45 +0200)] 
ftp: fix port number range loop for PORT commands

If the last port to test is 65535, the loop would previously wrongly
wrap the counter and start over at 0, which was not intended.

Reported in Joshua's sarif data

Closes #18636

2 months agosocks: make Curl_blockread_all return CURLcode
Daniel Stenberg [Sat, 20 Sep 2025 12:29:44 +0000 (14:29 +0200)] 
socks: make Curl_blockread_all return CURLcode

Reported in Joshua's sarif data

Closes #18635

2 months agoGHA/codeql: drop winbuild references [ci skip]
Viktor Szakats [Sat, 20 Sep 2025 13:07:15 +0000 (15:07 +0200)] 
GHA/codeql: drop winbuild references [ci skip]

Follow-up to 8d004781a577fc2fae72873c4a45b2fb3f366d98 #18040

2 months agobuild: avoid overriding system symbols for socket functions
Viktor Szakats [Tue, 9 Sep 2025 13:29:12 +0000 (15:29 +0200)] 
build: avoid overriding system symbols for socket functions

Before this patch `accept4()`, `socket()`, `socketpair()`, `send()` and
`recv()` system symbols were remapped via macros, using the same name,
to local curl debug wrappers. This patch replaces these overrides by
introducing curl-namespaced macros that map either to the system symbols
or to their curl debug wrappers in `CURLDEBUG` (TrackMemory) builds.

This follows a patch that implemented the same for `accept()`.

The old method required tricks to make these redefines work in unity
builds, and avoid them interfering with system headers. These tricks
did not work for system symbols implemented as macros.

The new method allows to setup these mappings once, without interfering
with system headers, upstream macros, or unity builds. It makes builds
more robust.

Also:
- checksrc: ban all mapped functions.
- docs/examples: tidy up checksrc rules.

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

Closes #18503

2 months agorustls: typecast variable for safer trace output
Daniel Stenberg [Sat, 20 Sep 2025 09:17:48 +0000 (11:17 +0200)] 
rustls: typecast variable for safer trace output

This is a variadic function call with a mismatched argument type; on
platforms where uintptr_t and size_t differ, this invokes undefined
behavior.

Reported in Joshua's sarif data

Closes #18628

2 months agotool_cb_hdr: size is always 1
Daniel Stenberg [Sat, 20 Sep 2025 09:31:54 +0000 (11:31 +0200)] 
tool_cb_hdr: size is always 1

- add comment in the header that the argument 'size' is always 1,
  as guaranteed by the libcurl API

- then fix the call to fwrite() to avoid using "size, etag_length" which
  would be wrong if size was something else than 1, and use a fixed
  number there instead.

Reported in Joshua's sarif data

Closes #18630

2 months agolibssh: error on bad chgrp number
Daniel Stenberg [Sat, 20 Sep 2025 09:25:38 +0000 (11:25 +0200)] 
libssh: error on bad chgrp number

To avoid it continuing with a zero gid.

Reported in Joshua's sarif data

Closes #18629

2 months agocurl_slist_append.md: clarify that a NULL pointer is not acceptable
Daniel Stenberg [Sat, 20 Sep 2025 09:11:35 +0000 (11:11 +0200)] 
curl_slist_append.md: clarify that a NULL pointer is not acceptable

Closes #18627

2 months agotidy-up: update MS links, allow long URLs via `checksrc`
Viktor Szakats [Fri, 19 Sep 2025 20:22:14 +0000 (22:22 +0200)] 
tidy-up: update MS links, allow long URLs via `checksrc`

- update Microsoft documentation links.
  (also drop language designator where present.)

- checksrc: allow longer than 78 character lines if they
  contain a https URL. To make these links easier to use and parse.

- merge links that were split into two lines.

Closes #18626

2 months agobuild: address some `-Weverything` warnings, update picky warnings
Viktor Szakats [Thu, 4 Sep 2025 09:56:33 +0000 (11:56 +0200)] 
build: address some `-Weverything` warnings, update picky warnings

`-Weverything` is not enabled by curl, and not recommended by LLVM,
because it may enable experimental options, and will result in new
fallouts after toolchain upgrades. This patch aims to fix/silence as much
as possible as found with llvm/clang 21.1.0. It also permanently enables
warnings that were fixed in source and deemed manageable in the future.
`-Wformat` warnings are addressed separately via #18343.

Fix/silence warnings in the source:
- typecheck-gcc.h: fix `-Wreserved-identifier`.
- lib: silence `-Wcast-function-type-strict`.
  For llvm 16+ or Apple clang 16+.
- asyn-ares: limit `HAPPY_EYEBALLS_DNS_TIMEOUT` to old c-ares versions.
- curl_trc: fix `-Wc++-hidden-decl`.
- doh: fix `-Wc++-keyword`.
- ftp: fix `-Wreserved-identifier`.
- ldap: fix `-Wreserved-identifier`.
- mqtt: comment unused macro to avoid warning.
- multi_ev: drop unused macros to avoid warnings.
- setopt: fix useless `break;` after `return;`.
- gtls, mbedtls, rustls: silence `-Wconditional-uninitialized`.
- socks_sspi, schannel, x509asn1: fix `-Wimplicit-int-enum-cast`.
- x509asn1: fix `-Wc++-keyword`.
- openssl: scope `OSSL_UI_METHOD_CAST` to avoid unused macro warning.
- libssh2, wolfssl: drop unused macros.
- curl_ngtcp2, curl_quiche, httpsrr, urlapi: drop/limit unused macros.
- tool_getparam: fix useless `break;` after `return;` or `break;`.
  Not normally enabled because it doesn't work with unity.
  https://github.com/llvm/llvm-project/issues/71046
- tool_operate: fix `-Wc++-keyword`.
- curlinfo: fix a `-Wunsafe-buffer-usage`.
- tests: silence `-Wformat-non-iso`.
- lib557: fix `-Wreserved-identifier`.
- lib1565: silence `-Wconditional-uninitialized`.

Enable the above clang warnings permanently in picky mode:
- `-Wc++-hidden-decl`
- `-Wc++-keyword` (except for Windows, where it collides with `wchar_t`)
- `-Wcast-function-type-strict`
- `-Wcast-function-type`
- `-Wconditional-uninitialized`
- `-Wformat-non-iso` (except for clang-cl)
- `-Wreserved-identifier`
- `-Wtentative-definition-compat`

Silence problematic `-Weverything` warnings globally (in picky mode):
- `-Wused-but-marked-unused` (88000+ hits) and
  `-Wdisabled-macro-expansion` (2600+ hits).
  Triggered by `typecheck-gcc.h` when building with clang 14+.
  Maybe there exists a way to fix within that header?
  Ref: https://discourse.llvm.org/t/removing-wused-but-marked-unused/55310
- `-Wunsafe-buffer-usage`. clang 16+. 7000+ hits.
  May be useful in theory, but such high volume of hits makes it
  impractical to review and possibly address. Meant for C++.
  Ref: https://clang.llvm.org/docs/SafeBuffers.html
  Ref: https://stackoverflow.com/questions/77017567/how-to-fix-code-to-avoid-warning-wunsafe-buffer-usage
  Ref: https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734
  Ref: https://github.com/llvm/llvm-project/pull/111624
- `-Wimplicit-void-ptr-cast`. clang 21+. 1700+ hits.
  C++ warning, deemed pure noise.
  Ref: https://github.com/curl/curl/issues/18470#issuecomment-3253506266
- `-Wswitch-default` (180+ hits), `-Wswitch-enum` (190+ hits),
  `-Wcovered-switch-default` (20+ hits).
  Next to impossible to fix cleanly, esp. when the covered `case`
  branches depend on compile-time options.
- `-Wdocumentation-unknown-command` (8+ hits).
  Triggered in a few sources. Seems arbitrary and bogus.
- `-Wpadded` (550+ hits).
- `-Wc++-keyword` on Windows, where it collides with `wchar_t`.
  (100+ hits)
  Ref: https://github.com/llvm/llvm-project/issues/155988
- `-Wreserved-macro-identifier`. clang 13+. 5+ hits.
  Sometimes it's necessary to set external macros that use
  the reserved namespace. E.g. `_CRT_NONSTDC_NO_DEPRECATE`,
  `__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__`, `__NO_NET_API`,
  possibly `_REENTRANT`, and more.
  It's not worth trying to silence them individually.
- `-Wnonportable-system-include-path` with `clang-cl`.
  It'd be broken by doing what the warning suggests.
- `-Wformat-non-iso` for clang-cl.

CMake `PICKY_COMPILER=ON` (the default) or `./configure`
`--enable-warnings` (not the default) is required to enable these
silencing rules.

Also:
- autotools, cmake: fix Apple clang and mainline llvm version translations.
  Ref: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
- autotools, cmake: enable `-Warray-compare` for clang 20+.
  Follow-up to 4b7accda5ae3f2e663aa3f3853805241ef87c2fe #17196
- cmake: fix to enable `-Wmissing-variable-declarations` at an earlier
  clang version.
- cmake: update internal logic to handle warning options with `+` in
  them.
- cmake: fix internal logic to match the whole option when looking
  into `CMAKE_C_FLAGS` for custom-disabled warnings.

Follow-up to b85cb8cb4e143d1615d4fcc1ce8f2f7b66453995 #18485

Closes #18477

2 months agowindows: stop passing unused, optional argument for Win9x compatibility
Viktor Szakats [Sun, 7 Sep 2025 19:42:41 +0000 (21:42 +0200)] 
windows: stop passing unused, optional argument for Win9x compatibility

Expiry timestamp in `AcquireCredentialsHandle()` (SSPI) and
`InitializeSecurityContext()` (Schannel) calls. The argument is optional
in both. The returned value was never used in curl. The reason for
passing it was Windows 95 compatibility, according to comments in
the SSPI code. curl no longer supports Windows 95.

Ref: https://learn.microsoft.com/windows/win32/api/sspi/nf-sspi-acquirecredentialshandlea
Ref: https://learn.microsoft.com/windows/win32/secauthn/initializesecuritycontext--schannel

Ref: 3fe531196771c8e81f917eebca4a06e062ab3a19
Ref: aaa42aa0d594b95c6c670a373ba30c507aa0a5ed

Closes #18490

2 months agotidy-up: avoid using the reserved macro namespace
Viktor Szakats [Fri, 5 Sep 2025 08:44:06 +0000 (10:44 +0200)] 
tidy-up: avoid using the reserved macro namespace

To avoid hitting `-Wreserved-macro-identifier` where possible.

- amigaos: introduce local macro instead of reusing `__request()`.
- easy_lock: avoid redefining `__has_builtin()`.
  Follow-up to 33fd57b8fff8c0d873da2316a2a7f911caac2bae #9062
- rand: drop interim macro `_random()`.
- windows: rename local macro `_tcsdup()` to `Curl_tcsdup()`.
  To avoid using the reserved macro namespace and to avoid
  colliding with `_tcsdup()` as defined by Windows headers.
- checksrc: ban `_tcsdup()` in favor of `Curl_tcsdup()`.
- tool_doswin: avoid redefining `_use_lfn()` (MS-DOS).
- tool_findfile: limit `__NO_NET_API` hack to AmigaOS.
  Syncing this pattern with `lib/netrc.c`.
  Follow-up to 784a8ec2c1a3cc4bd676077a28a0d5f6ee7786a5 #16279
- examples/http2-upload: avoid reserved namespace for local macro.

More cases will be removed when dropping WinCE support via #17927.

Cases remain when defining external macros out of curl's control.

Ref: #18477
Closes #18482

2 months agodigest_sspi: fix two memory leaks in error branches
Viktor Szakats [Sun, 7 Sep 2025 15:30:05 +0000 (17:30 +0200)] 
digest_sspi: fix two memory leaks in error branches

Closes #18488

2 months agocmake: add `CURL_CODE_COVERAGE` option
Viktor Szakats [Wed, 3 Sep 2025 12:32:29 +0000 (14:32 +0200)] 
cmake: add `CURL_CODE_COVERAGE` option

To sync up with the `--enable-code-coverage` `./configure` option.

Ref: https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html
Ref: https://gcc.gnu.org/onlinedocs/gcc/Cross-profiling.html
Ref: https://clang.llvm.org/docs/SourceBasedCodeCoverage.html

Closes #18468

2 months agoautotools: make `--enable-code-coverage` support llvm/clang
Viktor Szakats [Wed, 3 Sep 2025 14:48:49 +0000 (16:48 +0200)] 
autotools: make `--enable-code-coverage` support llvm/clang

Cherry-picked from #18468

Closes #18473

2 months agowindows: replace `_beginthreadex()` with `CreateThread()`
Viktor Szakats [Fri, 1 Aug 2025 19:09:52 +0000 (21:09 +0200)] 
windows: replace `_beginthreadex()` with `CreateThread()`

Replace `_beginthreadex()` C runtime calls with native win32 API
`CreateThread()`. The latter was already used in `src/tool_doswin.c`
and in UWP and Windows CE builds before this patch. After this patch
all Windows flavors use it. To drop PP logic and simplify code.

While working on this it turned out that `src/tool_doswin.c` calls
`TerminateThread()`, which isn't recommended by the documentation,
except for "the most extreme cases". This patch makes no attempt
to change that code.
Ref: 9a2663322c330ff11275abafd612e9c99407a94a #17572
Ref: https://learn.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminatethread

Also:
- use `WaitForSingleObjectEx()` on all desktop Windows.
  Ref: 4be80d5109a340973dc6ce0221ec5c5761587df0
  Ref: https://sourceforge.net/p/curl/feature-requests/82/
  Ref: https://learn.microsoft.com/windows/win32/api/synchapi/nf-synchapi-waitforsingleobjectex
- tests: drop redundant casts.
- lib3207: fix to not rely on thread macros when building without thread
  support.

Assisted-by: Jay Satiro
Assisted-by: Marcel Raad
Assisted-by: Michał Petryka
Follow-up to 38029101e2d78ba125732b3bab6ec267b80a0e72 #11625

Closes #18451

2 months agobuild: drop the winbuild build system
Viktor Szakats [Sun, 27 Jul 2025 11:50:03 +0000 (13:50 +0200)] 
build: drop the winbuild build system

In favor of CMake.

Closes #18040

2 months agobase64: accept zero length argument to base64_encode
Daniel Stenberg [Fri, 19 Sep 2025 11:47:16 +0000 (13:47 +0200)] 
base64: accept zero length argument to base64_encode

We used to treat 0 as "call strlen() to get the length" for
curlx_base64_encode, but it turns out this is rather fragile as we
easily do the mistake of passing in zero when the data is actually not
there and then calling strlen() is wrong.

Force the caller to pass in the correct size. A zero length input string
now returns a zero length output and a NULL pointer.

Closes #18617

2 months agogtls: avoid potential use of uninitialized variable in trace output
Daniel Stenberg [Fri, 19 Sep 2025 12:59:17 +0000 (14:59 +0200)] 
gtls: avoid potential use of uninitialized variable in trace output

Reported in Joshua's sarif data

Closes #18620

2 months agotool_getparam/set_rate: skip the multiplication on overflow
Daniel Stenberg [Fri, 19 Sep 2025 15:36:29 +0000 (17:36 +0200)] 
tool_getparam/set_rate: skip the multiplication on overflow

The code detected the problem but didn't avoid the calculation
correctly.

Fixes #18624
Reported-by: BobodevMm on github
Closes #18625

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 19 Sep 2025 14:47:01 +0000 (16:47 +0200)] 
RELEASE-NOTES: synced

and bump to 8.17.0

2 months agocookie: avoid saving a cookie file if no transfer was done
Daniel Stenberg [Fri, 19 Sep 2025 13:59:57 +0000 (15:59 +0200)] 
cookie: avoid saving a cookie file if no transfer was done

Because parts of the cookie loading happens on transfer start the
in-memory cookie jar risks being incomplete and then a save might
wrongly truncate the target file.

Added test 1902 to verify.

Reported-by: divinity76 on github
Fixes #18621
Closes #18622

2 months agotelnet: make printsub require another byte input
Daniel Stenberg [Fri, 19 Sep 2025 12:19:26 +0000 (14:19 +0200)] 
telnet: make printsub require another byte input

Reported in Joshua's sarif data

Closes #18618

2 months agocf_socket_recv: don't count reading zero bytes as first byte
Daniel Stenberg [Fri, 19 Sep 2025 11:23:14 +0000 (13:23 +0200)] 
cf_socket_recv: don't count reading zero bytes as first byte

Reported in Joshua's sarif data

Closes #18615

2 months agolibssh: react on errors from ssh_scp_read
Daniel Stenberg [Fri, 19 Sep 2025 11:35:23 +0000 (13:35 +0200)] 
libssh: react on errors from ssh_scp_read

Reported in Joshua's sarif data

Closes #18616

2 months agoGHA: tidy up actions/checkout version in comments [ci skip]
Viktor Szakats [Fri, 19 Sep 2025 12:20:14 +0000 (14:20 +0200)] 
GHA: tidy up actions/checkout version in comments [ci skip]

2 months agoGHA/codeql: try disabling the TRAP cache
Viktor Szakats [Fri, 19 Sep 2025 08:19:29 +0000 (10:19 +0200)] 
GHA/codeql: try disabling the TRAP cache

The `cpp` CodeQL job is adding a cache entry for each run on the master
branch. One for Linux, another for Windows. Size: 68MB + 180MB = 248MB.
In one week we got 50+ such entries, almost filling the available cache
space.

Following the recommendation in an open issue thread, this patch tries
to disable this cache. Since it only affects master, the effect can only
be verified after merging.

The latest cache is picked up in PRs. The performance impact is also to
be seen after merge.

Bug: https://github.com/curl/curl/pull/18528#issuecomment-3288950880
Ref: https://github.com/github/codeql-action/pull/1172
Ref: https://github.com/github/codeql-action/issues/2030
Ref: https://github.com/github/codeql-action/issues/2885#issuecomment-2879069087

Follow-up to cc50f05370981e4933504e8aaec6b15880ff847f #18528

Closes #18613

2 months agolibssh2: drop two redundant null-terminations
Viktor Szakats [Thu, 18 Sep 2025 21:25:28 +0000 (23:25 +0200)] 
libssh2: drop two redundant null-terminations

The null-termination was first added in the initial SFTP commit in 2006:
a634f644005cbe2b3dea2b84328d605ec3474054

At that time this was a reasonable concern because libssh2 started
null-terminating this string just one year prior, in 2005:
https://github.com/libssh2/libssh2/commit/efc3841fd2c2c945e96492e9089e4d1810709d53

This fix was released in libssh2 v0.13 (2006-03-02).

curl requires libssh2 v1.2.8, making this workaround no longer necessary.

Follow-up to 9f18cb6544bbf47e2e2fad6564bc03098273c7bc #18598

Closes #18606

2 months agotool_operate: keep the progress meter for --out-null
Daniel Stenberg [Fri, 19 Sep 2025 06:47:15 +0000 (08:47 +0200)] 
tool_operate: keep the progress meter for --out-null

Fixes #18607
Closes #18609

2 months agolibssh2: error check and null-terminate in ssh_state_sftp_readdir_link()
Viktor Szakats [Thu, 18 Sep 2025 12:02:51 +0000 (14:02 +0200)] 
libssh2: error check and null-terminate in ssh_state_sftp_readdir_link()

- null-terminate the result to match the other getter
  `libssh2_sftp_symlink_ex()` call.

- check negative result and bail out early.

Reported-by: Joshua Rogers
Closes #18598

2 months agoGHA/codeql: make it run on docs updates, to verify examples
Viktor Szakats [Thu, 18 Sep 2025 18:26:15 +0000 (20:26 +0200)] 
GHA/codeql: make it run on docs updates, to verify examples

Follow-up to b4922b1295333dc6679eb1d588ddc2fb6b7fd5b7 #18564

2 months agoexamples: fix two issues found by CodeQL
Viktor Szakats [Thu, 18 Sep 2025 16:50:09 +0000 (18:50 +0200)] 
examples: fix two issues found by CodeQL

- http2-upload: use `fstat()` to query file length to fix TOCTOU.

- ftpuploadresume: fix checking `sscanf()` return value.

Follow-up to b4922b1295333dc6679eb1d588ddc2fb6b7fd5b7 #18564
Closes #18605

2 months agotool_operate: Improve wording in retry message
Jay Satiro [Thu, 18 Sep 2025 15:38:20 +0000 (11:38 -0400)] 
tool_operate: Improve wording in retry message

- Use the plural 'seconds' for anything other than exactly 1 second.

Before: Will retry in 1.250 second.
After: Will retry in 1.250 seconds.

Follow-up to ca034e83.

Closes https://github.com/curl/curl/pull/18604

2 months agotftp: check and act on tftp_set_timeouts() returning error
Daniel Stenberg [Thu, 18 Sep 2025 15:32:39 +0000 (17:32 +0200)] 
tftp: check and act on tftp_set_timeouts() returning error

Reported-by: Joshua Rogers
Ref: https://github.com/curl/curl/pull/18574#issuecomment-3300183302
Closes #18603

2 months agotftp: propagate expired timer from tftp_state_timeout()
Joshua Rogers [Tue, 16 Sep 2025 19:52:28 +0000 (00:52 +0500)] 
tftp: propagate expired timer from tftp_state_timeout()

When Curl_timeleft() < 0 we used to return 0, masking the expiry and
skipping the caller’s (timeout_ms < 0) path. Now we set FIN and return
the negative value so tftp_multi_statemach() aborts with
CURLE_OPERATION_TIMEDOUT as intended.

Closes #18574

2 months agosocks_sspi: Fix some memory cleanup calls
Jay Satiro [Thu, 18 Sep 2025 06:07:17 +0000 (02:07 -0400)] 
socks_sspi: Fix some memory cleanup calls

- Ensure memory allocated by malloc() is freed by free().

Prior to this change SSPI's FreeContextBuffer() was sometimes used to
free malloc'd memory. I can only assume the reason we have no crash
reports about this is because the underlying heap free is probably the
same for both.

Reported-by: Joshua Rogers
Fixes https://github.com/curl/curl/issues/18587
Closes https://github.com/curl/curl/pull/18594

2 months agosasl: clear canceled mechanism instead of toggling it
Joshua Rogers [Tue, 16 Sep 2025 18:27:23 +0000 (23:27 +0500)] 
sasl: clear canceled mechanism instead of toggling it

Use &= ~authused in SASL_CANCEL (was ^=) to actually remove the offending
mechanism and avoid re-enabling a disabled mech on retry.

Closes #18573

2 months agoldap: do not base64 encode zero length string
Daniel Stenberg [Thu, 18 Sep 2025 13:50:17 +0000 (15:50 +0200)] 
ldap: do not base64 encode zero length string

Reported-by: Joshua Rogers
Closes #18602

2 months agoGHA/codeql: enable cares, debug, build curlinfo, examples
Viktor Szakats [Tue, 16 Sep 2025 09:47:38 +0000 (11:47 +0200)] 
GHA/codeql: enable cares, debug, build curlinfo, examples

Also build examples, out of curiousity, as an experiment, possibly
temporary. It needs around 40 seconds.

Closes #18564

2 months agoopenldap: avoid indexing the result at -1 for blank responses
Daniel Stenberg [Thu, 18 Sep 2025 13:02:03 +0000 (15:02 +0200)] 
openldap: avoid indexing the result at -1 for blank responses

Reported-by: Joshua Rogers
Closes #18600

2 months agosmb: adjust buffer size checks
Daniel Stenberg [Thu, 18 Sep 2025 12:49:09 +0000 (14:49 +0200)] 
smb: adjust buffer size checks

The checks did not account for the **two byte** 16bit read so risked
reading one more byte than what actually was received.

Reported-by: Joshua Rogers
Closes #18599

2 months agocfilter: unlink and discard
Stefan Eissing [Thu, 18 Sep 2025 09:10:45 +0000 (11:10 +0200)] 
cfilter: unlink and discard

Rewrite the code that removes a filter from the connection and discards
it. Always look at the connection, otherwise it will not work of the
filter is at the top of the chain.

Change QUIC filter setup code to always tear down the chain in
construction when an error occured.

HTTP proxy, do not remove the h1/h2 sub filter on close. Leave it to be
discarded with the connection. Avoids keeping an additional pointer that
might become dangling.

Triggered by a reported on a code bug in discard method.

Reported-by: Joshua Rogers
Closes #18596

2 months agotool: fix exponential retry delay
Daniel Stenberg [Thu, 18 Sep 2025 06:49:22 +0000 (08:49 +0200)] 
tool: fix exponential retry delay

Also, show retry delay with decimals since it might be not be integer
seconds.

Regression from da27db068fc888d7091d347080 (shipped in 8.16.0)

Reported-by: Andrew Olsen
Fixes #18591
Assisted-by: Jay Satiro
Closes #18595

2 months agosocks_sspi: restore non-blocking socket on error paths
Joshua Rogers [Wed, 17 Sep 2025 22:43:11 +0000 (03:43 +0500)] 
socks_sspi: restore non-blocking socket on error paths

Closes #18592

2 months agotool_cb_hdr: fix fwrite check in header callback
Joshua Rogers [Thu, 18 Sep 2025 01:45:12 +0000 (06:45 +0500)] 
tool_cb_hdr: fix fwrite check in header callback

Compare fwrite result to nmemb (items), not cb (bytes).

Closes #18593

2 months agosmtp: check EHLO responses case insensitively
Daniel Stenberg [Wed, 17 Sep 2025 21:22:36 +0000 (23:22 +0200)] 
smtp: check EHLO responses case insensitively

Adjust test 980 to announce starttls in lowercase.

Fixes #18588
Reported-by: Joshua Rogers
Closes #18589

2 months agomulti.h: add CURLMINFO_LASTENTRY
Christian Schmitz [Wed, 17 Sep 2025 08:11:59 +0000 (10:11 +0200)] 
multi.h: add CURLMINFO_LASTENTRY

For multiple enums, we use LASTENTRY values to do range checks when
receiving an option as integer. So I added LASTENTRY, so the check will
work, even if you add more options later.

Closes #18578

2 months agoconfigure: add "-mt" for pthread support on HP-UX
Michael Osipov [Wed, 17 Sep 2025 18:33:25 +0000 (20:33 +0200)] 
configure: add "-mt" for pthread support on HP-UX

HP-UX requires this compiler and linker flag to pass proper macros and
add required libraries.

Closes #18585

2 months agolibcurl-multi.md: added curl_multi_get_offt mention
Christian Schmitz [Wed, 17 Sep 2025 09:04:47 +0000 (11:04 +0200)] 
libcurl-multi.md: added curl_multi_get_offt mention

The multi interface page didn't mention the new curl_multi_get_offt
function.

Closes #18579

2 months agomanagen: render better manpage references/links
Daniel Stenberg [Wed, 17 Sep 2025 09:53:33 +0000 (11:53 +0200)] 
managen: render better manpage references/links

- When an option name is used in text, this script no longer outputs the
  short plus long version in the manpage output. It makes the text much
  more readable.

  This always showing both verions was previously done primarily to make
  sure roffit would linkify it correctly, but since roffit 0.17 it
  should link both long or short names correctly.

- When managen outputs generic text about options at the end of the
  description it now highlights them properly so that they too get
  linkified correctly in the HTML version. For consistency.

Closes #18580

2 months agomanagen: ignore version mentions < 7.66.0
Daniel Stenberg [Wed, 17 Sep 2025 11:02:01 +0000 (13:02 +0200)] 
managen: ignore version mentions < 7.66.0

Only mention version specific details for versions from within the last
six years.

Closes #18583

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 17 Sep 2025 08:30:31 +0000 (10:30 +0200)] 
RELEASE-NOTES: synced

2 months agosetopt: make CURLOPT_MAXREDIRS accept -1 (again)
Daniel Stenberg [Wed, 17 Sep 2025 06:25:42 +0000 (08:25 +0200)] 
setopt: make CURLOPT_MAXREDIRS accept -1 (again)

Regression from b059f7d (shipped in 8.16.0)

Reported-by: Adam Light
Fixes #18571
Closes #18576

2 months agodocs/libcurl: use lowercase must
Daniel Stenberg [Tue, 16 Sep 2025 14:49:54 +0000 (16:49 +0200)] 
docs/libcurl: use lowercase must

To shout less. Use bold in some places.

Closes #18570

2 months agoGHA: update openssl/openssl to v3.5.3
renovate[bot] [Tue, 16 Sep 2025 12:13:10 +0000 (12:13 +0000)] 
GHA: update openssl/openssl to v3.5.3

Closes #18566

2 months agodocs/libcurl: clarify some timeout option behavior
Daniel Stenberg [Tue, 16 Sep 2025 14:30:08 +0000 (16:30 +0200)] 
docs/libcurl: clarify some timeout option behavior

Closes #18569

2 months agoaws-lc: re-enable large read-ahead with v1.61.0 again
Stefan Eissing [Tue, 16 Sep 2025 13:49:58 +0000 (15:49 +0200)] 
aws-lc: re-enable large read-ahead with v1.61.0 again

AWS-LC fixed a bug with large read ahead buffers in v1.61.0. Check a
define introduced in that version to enable the large read ahead again.

AWS-LC issue: https://github.com/aws/aws-lc/issues/2650

Closes #18568

2 months agosws: fix checking `sscanf()` return value
Viktor Szakats [Tue, 16 Sep 2025 10:47:27 +0000 (12:47 +0200)] 
sws: fix checking `sscanf()` return value

Closes #18565

2 months agocmake: fix building docs when the base directory contains `.3`
Viktor Szakats [Tue, 16 Sep 2025 08:49:14 +0000 (10:49 +0200)] 
cmake: fix building docs when the base directory contains `.3`

Fixing:
```
ninja: error: '<...>/basedir.md/_bld/docs/libcurl/libcurl-symbols.md',
  needed by 'docs/libcurl/curl_easy_cleanup.3', missing and no known rule to make it
```

Reported-by: Nir Azkiel
Fixes #18560
Follow-up to 898b012a9bf388590c4be7f526815b5ab74feca1 #1288
Closes #18563

2 months agoMakefile.example: simplify and make it configurable
Viktor Szakats [Mon, 15 Sep 2025 13:01:54 +0000 (15:01 +0200)] 
Makefile.example: simplify and make it configurable

- build in a single step.

- allow overriding all variables:
  source, target, compiler, libpaths, libs, flags.

Example:
```shell
LIBS= LDFLAGS= SRC=altsvc.c make -f Makefile.example
```

Closes #18554

2 months agoGHA/codeql: enable more build options, build servers and tunits
Viktor Szakats [Mon, 15 Sep 2025 19:03:52 +0000 (21:03 +0200)] 
GHA/codeql: enable more build options, build servers and tunits

- add HTTP/3 build with OpenSSL 3.5, nghttp3 and ngtcp2.
- enable GSASL, Heimdal, rtmp, SSLS-export.
- make one build MultiSSL with GnuTLS, mbedTLS, Rustls, wolfSSL.
- build servers (also on Windows), and tunits.
- use Linuxbrew to install build dependencies missing from Ubuntu.

Coverage is now 466 C files. (was: 446)

Closes #18557

2 months agokrb5: return appropriate error on send failures
Daniel Stenberg [Tue, 16 Sep 2025 08:27:42 +0000 (10:27 +0200)] 
krb5: return appropriate error on send failures

Closes #18561

2 months agoGHA: Update nghttp2/nghttp2 to v1.67.1
renovate[bot] [Mon, 15 Sep 2025 12:00:44 +0000 (12:00 +0000)] 
GHA: Update nghttp2/nghttp2 to v1.67.1

Closes #18552

2 months agoGHA: bump actions/checkout from 4.2.2 to 5.0.0
dependabot[bot] [Mon, 15 Sep 2025 14:56:28 +0000 (14:56 +0000)] 
GHA: bump actions/checkout from 4.2.2 to 5.0.0

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.2.2...08c6903cd8c0fde910a37f88322edcfb5dd907a8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Closes #18556

2 months agoGHA/codeql: tidy up config names
Viktor Szakats [Mon, 15 Sep 2025 13:21:30 +0000 (15:21 +0200)] 
GHA/codeql: tidy up config names

Before this patch there was a single C config detected, named `build:`.

Closes #18555

2 months agotidy-up: whitespace
Viktor Szakats [Tue, 2 Sep 2025 12:20:26 +0000 (14:20 +0200)] 
tidy-up: whitespace

Closes #18553

2 months agoCURLOPT_TIMECONDITION.md: works for FILE and FTP as well
Daniel Stenberg [Mon, 15 Sep 2025 10:51:58 +0000 (12:51 +0200)] 
CURLOPT_TIMECONDITION.md: works for FILE and FTP as well

Closes #18551

2 months agocmdline-docs: extended, clarified, refreshed
Daniel Stenberg [Mon, 15 Sep 2025 08:33:19 +0000 (10:33 +0200)] 
cmdline-docs: extended, clarified, refreshed

Closes #18550

2 months agodist: do not distribute `CI.md`
Viktor Szakats [Sun, 14 Sep 2025 21:59:41 +0000 (23:59 +0200)] 
dist: do not distribute `CI.md`

`CI.md` slipped into the 8.15.0, 8.16.0 tarballs by accident.
Remove it again and update the checker exception.

Follow-up to fa3f889752e6b5034966de61a372a60773a69ca8 #17463

Closes #18549