]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 months agobuild: drop Heimdal support, update docs, replace with MIT Kerberos in CI
Viktor Szakats [Wed, 8 Oct 2025 10:03:18 +0000 (12:03 +0200)] 
build: drop Heimdal support, update docs, replace with MIT Kerberos in CI

The kerberos5 library Heimdal is one of three GSS libraries curl support.
It has a memory leak triggered by the new test in #18917 and the project
seems mostly abandoned.

Drop support and steer users to the MIT krb5 or GNU GSS libraries.

Co-authored-by: Daniel Stenberg
Ref: #18928
Closes #18928
Closes #18932

2 months agocmake/FindGSS: whitespace/formatting
Viktor Szakats [Wed, 8 Oct 2025 23:34:37 +0000 (01:34 +0200)] 
cmake/FindGSS: whitespace/formatting

Sync format more with the rest of the Find modules.

Cherry-picked from #18932
Closes #18957

2 months agoGHA/linux-old: sync terminology with other jobs [ci skip]
Viktor Szakats [Wed, 8 Oct 2025 17:07:03 +0000 (19:07 +0200)] 
GHA/linux-old: sync terminology with other jobs [ci skip]

Cherry-picked from #18932

2 months agocmake: minor Heimdal flavour detection fix
Viktor Szakats [Wed, 8 Oct 2025 19:40:07 +0000 (21:40 +0200)] 
cmake: minor Heimdal flavour detection fix

Do not detect Heimdal if a single `H` character appears in the vendor
string, require the full name: `Heimdal`.

Cherry-picked from #18932
Closes #18951

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 8 Oct 2025 21:35:37 +0000 (23:35 +0200)] 
RELEASE-NOTES: synced

2 months agoCURLOPT_COOKIEFILE.md: clarify when the cookies are loaded
Daniel Stenberg [Wed, 8 Oct 2025 05:58:16 +0000 (07:58 +0200)] 
CURLOPT_COOKIEFILE.md: clarify when the cookies are loaded

Closes #18924

2 months agohttp: make Content-Length parser more WHATWG
Daniel Stenberg [Wed, 8 Oct 2025 06:33:55 +0000 (08:33 +0200)] 
http: make Content-Length parser more WHATWG

Return error if there is something after the number other than
whitespace and newline.

Allow comma separated numbers and repeated headers as long as the new value is
the same as was set before.

Add test 767 to 771 to verify.

Reported-by: Ignat Loskutov
Fixes #18921
Closes #18925

2 months agoapple sectrust: check correct result on old OS versions
Stefan Eissing [Wed, 8 Oct 2025 09:56:09 +0000 (11:56 +0200)] 
apple sectrust: check correct result on old OS versions

On ancient Apple OS versions where SecTrustEvaluateWithError() is not
available, the deprected SecTrustEvaluate() is used. In that code
branch, the code checked the wong variable for the verified result.

Closes #18929

2 months agowolfssl: no double get_error() detail
Stefan Eissing [Wed, 8 Oct 2025 12:44:23 +0000 (14:44 +0200)] 
wolfssl: no double get_error() detail

Code was calling wolfSSL_get_error() on code that it had
already retrieved with the same function. Remove that.

Reported-by: Joshua Rogers
Closes #18940

2 months agocmake/FindGSS: fix `pkg-config` fallback logic for CMake <3.16
Viktor Szakats [Wed, 8 Oct 2025 16:49:51 +0000 (18:49 +0200)] 
cmake/FindGSS: fix `pkg-config` fallback logic for CMake <3.16

The documented `<prefix>_<moduleName>_VERSION` variables are empty in
all tested versions since 3.7.2 to 4.1.2. Stop using it as a fallback
for <3.16 versions, and replace with the undocumented, but working,
`FindPkgConfig` internal variable `_pkg_check_modules_pkg_name`. It
contains the module name which was found.

In practice it caused that with CMake <3.16 + `pkg-config`, curl always
detected the Heimdal flavor of GSS.

Also: Delete a fallback version detection method, which was already
marked with a question mark in comments, and used the same, always
empty, CMake variables.

Ref: https://cmake.org/cmake/help/v4.1/module/FindPkgConfig.html
Bug: https://github.com/curl/curl/pull/18932#issuecomment-3381807070

Closes #18950

2 months agoGHA/linux-old: dump logs on configure failure
Viktor Szakats [Wed, 8 Oct 2025 11:33:19 +0000 (13:33 +0200)] 
GHA/linux-old: dump logs on configure failure

As done in other jobs, but here tailored to old cmake.

The logs generated by ancient CMake aren't super useful though.

Cherry-picked from #18932
Closes #18948

2 months agoGHA: bump dependencies
dependabot[bot] [Wed, 8 Oct 2025 12:46:51 +0000 (12:46 +0000)] 
GHA: bump dependencies

- cryptography from 44.0.1 to 46.0.2 in tests/http
- ruff from 0.13.2 to 0.14.0 in .github/scripts
- reuse from 6.0.0 to 6.1.2 in .github/scripts
- github/codeql-action from 3.30.5 to 4.30.7

Closes #18941
Closes #18942
Closes #18943
Closes #18945
Closes #18947

2 months agoGHA/dependabot: tweak dir list to avoid a dupe, rename .txt file to avoid the bot
Viktor Szakats [Wed, 8 Oct 2025 12:50:58 +0000 (14:50 +0200)] 
GHA/dependabot: tweak dir list to avoid a dupe, rename .txt file to avoid the bot

It correctly picked all pips, but also picked
`tests/http/requirements.txt` twice and also
`.github/scripts/codespell-ignore.txt`. Try avoid these issues with this
patch.

Follow-up to 6a31e3137a1352aec528d768dee8d5a1c509f451 #18939

Closes #18946

2 months agoGHA/dependabot: find more pip deps, tweak commit prefix
Viktor Szakats [Wed, 8 Oct 2025 12:36:22 +0000 (14:36 +0200)] 
GHA/dependabot: find more pip deps, tweak commit prefix

Before this patch the Dependabot updater was only picking up
`tests/requirements.txt`:
https://github.com/curl/curl/network/updates/26616523/jobs

Also prefix commit messages with `GHA:`.

Bug: https://github.com/curl/curl/pull/18761#issuecomment-3381147189
Follow-up to b04137c1c6ed164594279c7d04b5e051634453ea #18761

Closes #18939

2 months agoGHA/checksrc: also run on .md file changes
Viktor Szakats [Wed, 8 Oct 2025 11:41:50 +0000 (13:41 +0200)] 
GHA/checksrc: also run on .md file changes

To avoid missing e.g. codespell issue when updating Markdown files only,
as in 82fd9edb0e0313f206b23f90a000164b52412072 #18927

Follow-up to 0b54ce6ffc395148f2c43ce4664ecd9678f822bd

Closes #18935

2 months agoINSTALL-CMAKE.md: fix typo in prev
Viktor Szakats [Wed, 8 Oct 2025 11:37:29 +0000 (13:37 +0200)] 
INSTALL-CMAKE.md: fix typo in prev

Not caught in original PR. Fixing it in CI separately.

Follow-up 82fd9edb0e0313f206b23f90a000164b52412072 #18927

2 months agoINSTALL-CMAKE.md: document useful build targets
Viktor Szakats [Wed, 8 Oct 2025 09:15:13 +0000 (11:15 +0200)] 
INSTALL-CMAKE.md: document useful build targets

Closes #18927

2 months agotests/server: drop pointless memory allocation overrides
Viktor Szakats [Wed, 8 Oct 2025 01:09:23 +0000 (03:09 +0200)] 
tests/server: drop pointless memory allocation overrides

The code was overriding system memory allocation functions to a local
jump table (declared in `curl_setup.h`). And setup that jump table
to call the original system allocation functions.

Also tested fine with cegcc/WinCE. The `_strdup` fallback was possibly
required for an MSVC WinCE toolchain.

Closes #18922

2 months agoh3/ngtcp2: close just-opened QUIC stream when submit_request fails
Joshua Rogers [Tue, 7 Oct 2025 05:59:29 +0000 (13:59 +0800)] 
h3/ngtcp2: close just-opened QUIC stream when submit_request fails

Closes #18904

2 months agoh3/nghttp3: return NGHTTP3_ERR_CALLBACK_FAILURE from recv_header
Joshua Rogers [Tue, 7 Oct 2025 05:59:09 +0000 (13:59 +0800)] 
h3/nghttp3: return NGHTTP3_ERR_CALLBACK_FAILURE from recv_header

Closes #18904

2 months agoopenssl: skip session resumption when verifystatus is set
Joshua Rogers [Tue, 7 Oct 2025 02:31:18 +0000 (10:31 +0800)] 
openssl: skip session resumption when verifystatus is set

Resumed TLS sessions skip OCSP stapled-response verification.
Force a full handshake so verifystatus() runs.

Closes #18902

2 months agoexamples/sessioninfo: cast printf string mask length to int
Viktor Szakats [Tue, 7 Oct 2025 18:30:06 +0000 (20:30 +0200)] 
examples/sessioninfo: cast printf string mask length to int

Found via `-Wformat-signedness`:
```
docs/examples/sessioninfo.c: In function 'wrfu':
docs/examples/sessioninfo.c:75:53: error: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'unsigned int' [-Werror=format=]
  fprintf(stderr, "Certificate #%u: %.*s", i, dn.size, dn.data);
                                      ^
```
Ref: https://github.com/curl/curl/actions/runs/18320729052/job/52172864438?pr=18343#step:13:30
Ref: https://github.com/curl/curl/actions/runs/18320729095/job/52172886899?pr=18343#step:19:27

Also:
- drop unnecessary parenthesis.
- scope variables.

Ref: #18343
Closes #18918

2 months agonotify: use 'notify' in public header and docs
Viktor Szakats [Tue, 7 Oct 2025 10:47:19 +0000 (12:47 +0200)] 
notify: use 'notify' in public header and docs

Closes #18915

2 months agocmake: support building some complicated examples, build them in CI
Viktor Szakats [Tue, 7 Oct 2025 10:36:49 +0000 (12:36 +0200)] 
cmake: support building some complicated examples, build them in CI

Build these examples when the necessary dependencies are present:
- cacertinmem, usercertinmem (OpenSSL/fork)
- multi-uv (libuv)
- multithread, threaded-ssl (pthread)
- sessioninfo (GnuTLS)

Indicate the necessary dependency via a `Required:` comment placed in
the source file. A single dependency per source is supported as of now.
The name of the dependency should match the variable used within
the cmake scripts, which in turn matches the macro used in the config
header. E.g. for GnuTLS it's `USE_GNUTLS`.

Also:
- GHA/macos: build examples in two job to test GnuTLS and pthread ones.
- GHA/linux: enable libuv to test it with examples.

Follow-up to 6bb77140322565ca17f5a66aa5d8500d8d469cca #18914
Closes #18909

2 months agongtcp2: fix handling of blocked stream data
Stefan Eissing [Tue, 7 Oct 2025 09:30:46 +0000 (11:30 +0200)] 
ngtcp2: fix handling of blocked stream data

The stream blocking might not be the one of the current easy handle.
Look up the stream to be marked as blocking via its stream_id in the
internal hash. Theoretically, this does not have to be one of the h3
streams, so not finding it is not an error.

Fixes #18905
Reported-by: Joshua Rogers
Closes #18906

2 months agoosslq: set out idle timeout to 0
Stefan Eissing [Tue, 7 Oct 2025 10:05:08 +0000 (12:05 +0200)] 
osslq: set out idle timeout to 0

Similar to our ngtcp2 backend, set our idle timeout for the connection
to 0, meaning we have no such timeout from our side. The effective idle
timeout is then the one announced by the peer.

Closes #18907

2 months agoCURLMOPT_NOTIFYFUNCTION.md: minor language polish
Daniel Stenberg [Tue, 7 Oct 2025 14:18:22 +0000 (16:18 +0200)] 
CURLMOPT_NOTIFYFUNCTION.md: minor language polish

- mention the possibility of new types in the future
- s/a an/an

Closes #18913

2 months agomulti: use CURLMNOTIFY_ as notification id prefix
Daniel Stenberg [Tue, 7 Oct 2025 14:00:59 +0000 (16:00 +0200)] 
multi: use CURLMNOTIFY_ as notification id prefix

Since CURLM_ is already used as prefix for multi error codes, it makes
it easier to detect and understand the difference between identifiers -
and allows for scripts on the website and elsewhere to separate them
properly.

Follow-up to 53be8166b2b16d9682
Closes #18912

2 months agoexamples: fix build issues in 'complicated' examples
Viktor Szakats [Tue, 7 Oct 2025 11:54:17 +0000 (13:54 +0200)] 
examples: fix build issues in 'complicated' examples

- cacertinmem: build cleanly with BoringSSL/AWS-LC.
- cacertinmem: silence `-Wcast-function-type-strict`.
- multi-uv: fix callback prototypes.
- multithread, threaded-ssl: do not pass const as thread arg.
- sessioninfo: fix suppressing deprecated feature warning.
- usercertinmem: sync formatting with cacertinmem.

Follow-up to 4a6bdd5899005c25ce222dc21dcfd1a779544330 #18908
Cherry-picked from #18909
Closes #18914

2 months agomulti: notify rename, remove the last stragglers
Stefan Eissing [Tue, 7 Oct 2025 11:40:05 +0000 (13:40 +0200)] 
multi: notify rename, remove the last stragglers

in the public API.

Follow-up to 357808f4addef44c2c48f17d

Closes #18910

2 months agocmake: build the "all" examples source list dynamically
Viktor Szakats [Tue, 7 Oct 2025 12:04:12 +0000 (14:04 +0200)] 
cmake: build the "all" examples source list dynamically

To allow building conditional examples, and to simplify by avoiding
cmake-version dependent code.

Follow-up to fe5225b5eaf3a1a0ce149023d38a9922a114798b #18209
Cherry-picked from #18909
Closes #18911

2 months agosocks: handle premature close
Stefan Eissing [Mon, 6 Oct 2025 12:08:07 +0000 (14:08 +0200)] 
socks: handle premature close

When expecting to receive a number of bytes during socks connect,
treat an early connection close as error.

Reported-by: Joshua Rogers
Closes #18883

2 months agoexamples/usercertinmem: avoid stripping const
Viktor Szakats [Tue, 7 Oct 2025 10:04:03 +0000 (12:04 +0200)] 
examples/usercertinmem: avoid stripping const

This API started accepting a const somewhere between OpenSSL 1.0.2b and
1.0.2t. It means this example, like the other similar one now works best
with those versions or newer:
```
docs/examples/usercertinmem.c:100:33: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  100 |   bio = BIO_new_mem_buf((char *)mypem, -1);
      |                                 ^
docs/examples/usercertinmem.c:121:34: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  121 |   kbio = BIO_new_mem_buf((char *)mykey, -1);
      |                                  ^
```

Closes #18908

2 months agovquic/ngtcp2: compare idle timeout in ms to avoid overflow
Joshua Rogers [Tue, 7 Oct 2025 07:48:36 +0000 (15:48 +0800)] 
vquic/ngtcp2: compare idle timeout in ms to avoid overflow

Closes #18903

2 months agovquic: fix idle-timeout checks (ngtcp2 ms<-->ns), 64-bit log & honor 0=no-timeout...
Joshua Rogers [Tue, 7 Oct 2025 05:34:26 +0000 (13:34 +0800)] 
vquic: fix idle-timeout checks (ngtcp2 ms<-->ns), 64-bit log & honor 0=no-timeout (osslquic)

Closes #18903

2 months agomulti: add notifications API
Stefan Eissing [Mon, 1 Sep 2025 09:58:16 +0000 (11:58 +0200)] 
multi: add notifications API

Add infrastructure to colled and dispatch notifications for transfers
and the multi handle in general. Applications can register a callback
and en-/disable notification type the are interested in.

Without a callback installed, notifications are not collected. Same when
a notification type has not been enabled.

Memory allocation failures on adding notifications lead to a general
multi failure state and result in CURLM_OUT_OF_MEMORY returned from
curl_multi_perform() and curl_multi_socket*() invocations.

Closes #18432

2 months agongtcp2: fix returns when TLS verify failed
Stefan Eissing [Mon, 6 Oct 2025 11:16:55 +0000 (13:16 +0200)] 
ngtcp2: fix returns when TLS verify failed

In both send/recv functions of the ngtcp2 filter, when TLS verification
has failed, jump out by skipping ingress/egress handling.

Reported-by: Joshua Rogers
Closes #18881

2 months agoexamples/synctime: make the sscanf not overflow the local buffer
Daniel Stenberg [Mon, 6 Oct 2025 14:19:21 +0000 (16:19 +0200)] 
examples/synctime: make the sscanf not overflow the local buffer

If the incoming Date: header has a funky format.

Bonus: remove bad null terminator assumptions for header

Reported-by: Stanislav Fort
Closes #18890

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 6 Oct 2025 21:59:33 +0000 (23:59 +0200)] 
RELEASE-NOTES: synced

2 months agotelnet: ignore empty suboptions
Daniel Stenberg [Mon, 6 Oct 2025 21:05:10 +0000 (23:05 +0200)] 
telnet: ignore empty suboptions

To avoid printing from en empty buffer

Reported-by: Joshua Rogers
Closes #18899

2 months agotftp: return error if it hits an illegal state
Daniel Stenberg [Mon, 6 Oct 2025 16:25:55 +0000 (18:25 +0200)] 
tftp: return error if it hits an illegal state

Reported-by: Joshua Rogers
Closes #18894

2 months agotftp: default timeout per block is now 15 seconds
Daniel Stenberg [Mon, 6 Oct 2025 15:32:50 +0000 (17:32 +0200)] 
tftp: default timeout per block is now 15 seconds

Down from the previous (rather ridiculous) 3600.

Reported-by: Joshua Rogers
Closes #18893

2 months agotftp: don't pin or check address if recvfrom returns error
Daniel Stenberg [Mon, 6 Oct 2025 15:23:18 +0000 (17:23 +0200)] 
tftp: don't pin or check address if recvfrom returns error

Follow-up to c4f9977c66bbb05a837a7eb0300
Reported-by: Joshua Rogers
Closes #18892

2 months agonoproxy: fix the IPV6 network mask pattern match
Daniel Stenberg [Mon, 6 Oct 2025 14:53:27 +0000 (16:53 +0200)] 
noproxy: fix the IPV6 network mask pattern match

It would mismatch if the network prefix length with was not divisible by
8.

Extended test 1614 to verify

Reported-by: Stanislav Fort
Closes #18891

2 months agomdlinkcheck: reject URLs containing quotes
Daniel Stenberg [Mon, 6 Oct 2025 14:10:27 +0000 (16:10 +0200)] 
mdlinkcheck: reject URLs containing quotes

Those would be illegal anyway and would make the script misbehave

Reported-by: Stanislav Fort
Closes #18889

2 months agotelnet: send failure logged but not returned
Daniel Stenberg [Mon, 6 Oct 2025 13:01:48 +0000 (15:01 +0200)] 
telnet: send failure logged but not returned

Return error correctly when sending fails.

Reported-by: Joshua Rogers
Closes #18887

2 months agotelnet: return error if WSAEventSelect fails
Daniel Stenberg [Mon, 6 Oct 2025 12:59:53 +0000 (14:59 +0200)] 
telnet: return error if WSAEventSelect fails

Reported-by: Joshua Rogers
Closes #18886

2 months agomanagen: verify the options used in example lines
Daniel Stenberg [Mon, 6 Oct 2025 12:41:14 +0000 (14:41 +0200)] 
managen: verify the options used in example lines

Also fix the --knownhosts typo

Follow-up to aae18c4bdc1a3bf5

Reported-by: Daniel Terhorst-North
URL: https://mas.to/@tastapod/115327102344617386
Closes #18884

2 months agopingpong: remove two old leftover debug infof() calls
Daniel Stenberg [Mon, 6 Oct 2025 11:05:01 +0000 (13:05 +0200)] 
pingpong: remove two old leftover debug infof() calls

2 months agotest766: verify CURLOPT_SOCKOPTFUNCTION error on accept
Daniel Stenberg [Mon, 6 Oct 2025 10:43:40 +0000 (12:43 +0200)] 
test766: verify CURLOPT_SOCKOPTFUNCTION error on accept

This test does active FTP with a socketopt callback that returns error
for the CURLSOCKTYPE_ACCEPT "purpose" to make sure we test and exercise
this error path - without leaks.

Closes #18879

2 months agocurl_osslq: error out properly if BIO_ADDR_rawmake() fails
Daniel Stenberg [Mon, 6 Oct 2025 10:27:36 +0000 (12:27 +0200)] 
curl_osslq: error out properly if BIO_ADDR_rawmake() fails

Reported-by: Joshua Rogers
Closes #18878

2 months agolibssh2/sftp_realpath: change state consistently
Daniel Stenberg [Mon, 6 Oct 2025 09:07:47 +0000 (11:07 +0200)] 
libssh2/sftp_realpath: change state consistently

Change the state in this function at a single spot independent of
success or not to simplify.

Reported-by: Joshua Rogers
Closes #18875

2 months agolibssh2: fix return code for EAGAIN
Daniel Stenberg [Mon, 6 Oct 2025 09:03:35 +0000 (11:03 +0200)] 
libssh2: fix return code for EAGAIN

In disconnect

Closes #18874

2 months agotidy-up: miscellaneous (cont.)
Viktor Szakats [Mon, 29 Sep 2025 10:36:14 +0000 (12:36 +0200)] 
tidy-up: miscellaneous (cont.)

- examples: replace magic numbers with `sizeof()`.
- typos: drop rules no longer needed after excluding tests/data.
- typos: move an exception inline.
- alpha-sort lists.
- fix indentation, whitespace.

Closes #18898

2 months agolib: stop overriding system printf symbols
Viktor Szakats [Sat, 4 Oct 2025 10:58:49 +0000 (12:58 +0200)] 
lib: stop overriding system printf symbols

After this patch, the codebase no longer overrides system printf
functions. Instead it explicitly calls either the curl printf functions
`curl_m*printf()` or the system ones using their original names.

Also:
- drop unused `curl_printf.h` includes.
- checksrc: ban system printf functions, allow where necessary.

Follow-up to db98daab05aec251bcb6615d2d38dfebec291736 #18844
Follow-up to 4deea9396bc7dd25c6362fa746a57bf309c74ada #18814

Closes #18866

2 months agoREUSE: bump reuse to v6, add more fences to fix issues
Viktor Szakats [Mon, 6 Oct 2025 18:35:38 +0000 (20:35 +0200)] 
REUSE: bump reuse to v6, add more fences to fix issues

Closes #18895
Closes #18897

2 months agoGHA/configure-vs-cmake: reduce windows cross-toolchain apt installs
Viktor Szakats [Mon, 6 Oct 2025 18:00:55 +0000 (20:00 +0200)] 
GHA/configure-vs-cmake: reduce windows cross-toolchain apt installs

Download size: 277 MB -> 65 MB (installed: 1293 MB -> 401 MB)

Also as a workaround for Azure Ubuntu mirror slowdown issues:
https://github.com/curl/curl/actions/runs/18289326469/job/52072333582?pr=18866

Follow-up to 0455d8772a1af20ce63c46c5738582aa9b1b8441 #18509

Closes #18896

2 months agoldap: tidy-up types, fix error code confusion
Viktor Szakats [Mon, 6 Oct 2025 13:46:29 +0000 (15:46 +0200)] 
ldap: tidy-up types, fix error code confusion

- fix `CURLcode` vs. LDAP result code confusion.
  Return `LDAP_NO_MEMORY` when `Curl_create_sspi_identity()` fails,
  since it can only return `CURLE_OUT_OF_MEMORY` as error.
- use `ULONG` for result code on Windows. Drop casts.
- use portable `curl_ldap_num_t`. Drop casts.
- replace magic number 0 with `LDAP_SUCCESS`.
- compare with `LDAP_SUCCESS` instead of assuming non-zero.
  (where necessary.)
- add/fix `#endif` comments.
- fix indentation.

Closes #18888

2 months agotelnet: make bad_option() consider NULL a bad option too
Daniel Stenberg [Mon, 6 Oct 2025 08:56:44 +0000 (10:56 +0200)] 
telnet: make bad_option() consider NULL a bad option too

Follow-up to a72e1552f22
Closes #18873

2 months agoftp: remove misleading comments
Daniel Stenberg [Mon, 6 Oct 2025 08:34:22 +0000 (10:34 +0200)] 
ftp: remove misleading comments

They indicated that sockets would not be closed but they are.

Reported-by: Joshua Rogers
Closes #18871

2 months agoftp: improve fragile check for first digit > 3
Daniel Stenberg [Mon, 6 Oct 2025 08:20:45 +0000 (10:20 +0200)] 
ftp: improve fragile check for first digit > 3

In a case where rubbish would be sent in the line something that isn't a
digit could be first in line and treated as less than '3'. Prevent this
risk by first doing a check that the byte is a digit.

Reported-by: Joshua Rogers
Closes #18870

2 months agoftp: add extra buffer length check
Daniel Stenberg [Mon, 6 Oct 2025 08:11:30 +0000 (10:11 +0200)] 
ftp: add extra buffer length check

This adds an extra check that the buffer really has data enough (at
least 4 bytes) to check for a status code before doing so. It *should*
not be necessary, but this was pointed out by an analyzer and it feels
better to make sure.

Reported-by: Joshua Rogers
Closes #18869

2 months agoftp: fix the 213 scanner memchr buffer limit argument
Daniel Stenberg [Mon, 6 Oct 2025 07:54:39 +0000 (09:54 +0200)] 
ftp: fix the 213 scanner memchr buffer limit argument

Reported-by: Joshua Rogers
Closes #18867

2 months agocf-socket: check params and remove accept procondition
Stefan Eissing [Mon, 6 Oct 2025 11:45:38 +0000 (13:45 +0200)] 
cf-socket: check params and remove accept procondition

- creating a socket filter with NULL addrinfo fails with
  CURLE_BAD_FUNCTION_ARGUMENT
- remove getsockname use before accept call, serves no purpose
  and did not lead to proper error before

Reported-by: Joshua Rogers
Closes #18882

2 months agocf-socket: always check Curl_cf_socket_peek() return code
Daniel Stenberg [Mon, 6 Oct 2025 06:22:39 +0000 (08:22 +0200)] 
cf-socket: always check Curl_cf_socket_peek() return code

Make it trigger a warning if not.

Reported-by: Joshua Rogers
Closes #18862

2 months agowindows: use consistent format when showing error codes
Viktor Szakats [Mon, 6 Oct 2025 01:02:24 +0000 (03:02 +0200)] 
windows: use consistent format when showing error codes

For `GetLastError()` and `SECURITY_STATUS`:
0x-prefixed, 8-digit, lowercase, hex: 0x1234abcd

Also: say `GetLastError()` instead of `errno` in one message.

Closes #18877

2 months agokrb5_sspi: the chlg argument is NOT optional
Daniel Stenberg [Mon, 6 Oct 2025 07:44:45 +0000 (09:44 +0200)] 
krb5_sspi: the chlg argument is NOT optional

Fix the comment, add assert.

Reported-by: Joshua Rogers
Closes #18865

2 months agolibssh2: clarify that sshp->path is always at least one byte
Daniel Stenberg [Mon, 6 Oct 2025 07:38:30 +0000 (09:38 +0200)] 
libssh2: clarify that sshp->path is always at least one byte

Reported-by: Joshua Rogers
Closes #18864

2 months agolibssh2: bail out on chgrp and chown number parsing errors
Daniel Stenberg [Mon, 6 Oct 2025 07:02:09 +0000 (09:02 +0200)] 
libssh2: bail out on chgrp and chown number parsing errors

Reported-by: Joshua Rogers
Closes #18863

2 months agotest1711: send a >64K mail with SMTP
Daniel Stenberg [Mon, 6 Oct 2025 05:51:48 +0000 (07:51 +0200)] 
test1711: send a >64K mail with SMTP

A failed attempt to reproduce #18798

Closes #18861

2 months agotool_getparam: add --knownhosts
Daniel Stenberg [Sun, 5 Oct 2025 21:19:13 +0000 (23:19 +0200)] 
tool_getparam: add --knownhosts

To allow users to specify a known hosts file that is not the default
one: ~/.ssh/known_hosts

URL: https://github.com/curl/curl/discussions/18784
Closes #18859

2 months agoquiche: fix possible leaks on teardown
Stefan Eissing [Mon, 6 Oct 2025 11:05:14 +0000 (13:05 +0200)] 
quiche: fix possible leaks on teardown

When the close of the quiche filter was never called, the destroy function
did not release all allicated resources.

When closing a quiche filter, set the connected flag to FALSE.

Reported-by: Joshua Rogers
Closes #18880

2 months agowindows: use native error code types more
Viktor Szakats [Mon, 6 Oct 2025 00:33:49 +0000 (02:33 +0200)] 
windows: use native error code types more

- curlx_get_winapi_error: accept DWORD (was: int), move casts one level
  up the callstack.

- sspi: bump some types to `SECURITY_STATUS` (int -> LONG).

- digest_sspi: drop unnecessary cast.

Closes #18868

2 months agoopenssl: call SSL_get_error() with proper error
Daniel Stenberg [Mon, 6 Oct 2025 08:39:29 +0000 (10:39 +0200)] 
openssl: call SSL_get_error() with proper error

The error function should be called with the return code from the
previous call to SSL_shutdown() as argument.

Closes #18872

2 months agosrc: stop overriding system printf symbols
Viktor Szakats [Sat, 4 Oct 2025 10:24:57 +0000 (12:24 +0200)] 
src: stop overriding system printf symbols

Also:
- tool_operate: use the socket printf mask, drop cast.

Follow-up to 4deea9396bc7dd25c6362fa746a57bf309c74ada #18814

Closes #18844

2 months agocurlx: move Curl_strerror, use in src and tests, ban `strerror` globally
Viktor Szakats [Sat, 4 Oct 2025 01:10:37 +0000 (03:10 +0200)] 
curlx: move Curl_strerror, use in src and tests, ban `strerror` globally

Also:
- tests/server: replace local `sstrerror()` with `curlx_strerror()`.
- tests/server: show the error code next to the string, where missing.
- curlx: use `curl_msnprintf()` when building for src and tests.
  (units was already using it.)
- lib: drop unused includes found along the way.
- curlx_strerror(): avoid compiler warning (and another similar one):
  ```
  In file included from servers.c:14:
  ../../lib/../../lib/curlx/strerr.c: In function ‘curlx_strerror’:
  ../../lib/../../lib/curlx/strerr.c:328:32: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
    328 |       SNPRINTF(buf, buflen, "%s", msg);
        |                                ^
  ../../lib/../../lib/curlx/strerr.c:47:18: note: ‘snprintf’ output 1 or more bytes (assuming 2) into a destination of size 1
     47 | #define SNPRINTF snprintf
        |                  ^
  ../../lib/../../lib/curlx/strerr.c:328:7: note: in expansion of macro ‘SNPRINTF’
    328 |       SNPRINTF(buf, buflen, "%s", msg);
        |       ^~~~~~~~
  ```

Follow-up to 45438c8d6f8e70385d66c029568524e9e803c539 #18823

Closes #18840

2 months agotests/server: replace banned functions with `curlx_str_hex`
Viktor Szakats [Fri, 3 Oct 2025 22:39:11 +0000 (00:39 +0200)] 
tests/server: replace banned functions with `curlx_str_hex`

Replace an `strtol()` and `strtoul()` call, both used in hex mode, with
`curlx_str_hex()`.

Follow-up to 45438c8d6f8e70385d66c029568524e9e803c539 #18823

Closes #18837

2 months agounit1323: sync time types and printf masks, drop casts
Viktor Szakats [Sun, 5 Oct 2025 22:10:13 +0000 (00:10 +0200)] 
unit1323: sync time types and printf masks, drop casts

Closes #18860

2 months agotool_filetime: replace cast with the fitting printf mask (Windows)
Viktor Szakats [Sun, 5 Oct 2025 18:36:21 +0000 (20:36 +0200)] 
tool_filetime: replace cast with the fitting printf mask (Windows)

Follow-up to d25b0503795f1fbf557632ce870298f52f2a78c1 #2204

Closes #18858

2 months agourl: make Curl_init_userdefined return void
Daniel Stenberg [Sun, 5 Oct 2025 12:07:39 +0000 (14:07 +0200)] 
url: make Curl_init_userdefined return void

It cannot actually return an error, so the parent function does not need
to check for error and have an exit path that cannot be reached.

Pointed out by CodeSonar

Closes #18855

2 months agostrerror: drop workaround for SalfordC win32 header bug
Viktor Szakats [Sun, 5 Oct 2025 16:36:06 +0000 (18:36 +0200)] 
strerror: drop workaround for SalfordC win32 header bug

Follow-up to ccf43ce91dd9a56f30a4029377126e4c83c7f08a #15957

Closes #18857

2 months agoGHA/http3-linux: cleanup cache entry name after prev
Viktor Szakats [Sun, 5 Oct 2025 09:08:40 +0000 (11:08 +0200)] 
GHA/http3-linux: cleanup cache entry name after prev

To avoid duplicate `no-deprecated` in the cache entry name.

Follow-up to c96bf36557ea2302e4cb838ee1e4bb9827fecee7 #18833

Closes #18853

2 months agotelnet: print DISPlay LOCation in printsub without mutating buffer
Joshua Rogers [Sun, 5 Oct 2025 03:07:54 +0000 (11:07 +0800)] 
telnet: print DISPlay LOCation in printsub without mutating buffer

Closes #18852

2 months agotelnet: use pointer[0] for "unknown" option instead of pointer[i]
Joshua Rogers [Sun, 5 Oct 2025 02:57:29 +0000 (10:57 +0800)] 
telnet: use pointer[0] for "unknown" option instead of pointer[i]

i is taken from pointer[length-2] (often the IAC byte) before we do
length -= 2, so using pointer[i] indexes an arbitrary/stale byte
unrelated to the option code. pointer[0] is the suboption’s option code
per the telnet SB format, so printing pointer[0] yields correct, stable
diagnostics.

Closes #18851

2 months agocpool: make bundle->dest an array; fix UB
Joshua Rogers [Sun, 5 Oct 2025 02:38:14 +0000 (10:38 +0800)] 
cpool: make bundle->dest an array; fix UB

Replace `char *dest[1]` with a proper `char dest[1]` array in
cpool_bundle. This removes undefined behavior from memcpy (writing past
the declared object) while keeping the same key semantics: dest_len is
strlen+1 (includes NUL), and hash add/delete calls remain unchanged.

Closes #18850

2 months agoGHA: remove the hacktoberfest label action
Daniel Stenberg [Sat, 4 Oct 2025 21:17:32 +0000 (23:17 +0200)] 
GHA: remove the hacktoberfest label action

No one cares about hacktoberfest anymore.

Closes #18849

2 months agochecksrc: fix possible endless loops/errors in the banned function logic
Viktor Szakats [Sat, 4 Oct 2025 11:04:29 +0000 (13:04 +0200)] 
checksrc: fix possible endless loops/errors in the banned function logic

By quoting the search expression to be replaced. This avoid the issue
when the code leading up to a banned function contained regex characters
that the script did not explicitly handle, e.g. `+`.

Assisted-by: Daniel Stenberg
Ref: https://perldoc.perl.org/functions/quotemeta
Follow-up to dd37d6970cfd8b4cf47ebd469f03772813b92c23 #18775

Closes #18845

2 months agounit1664: drop casts, expand masks to full values
Viktor Szakats [Sat, 4 Oct 2025 00:53:02 +0000 (02:53 +0200)] 
unit1664: drop casts, expand masks to full values

Follow-up to 4deea9396bc7dd25c6362fa746a57bf309c74ada #18814

Closes #18838

2 months agoGHA: drop quictls 3.3.0 builds in favor of openssl 3.5+
Viktor Szakats [Fri, 3 Oct 2025 14:40:28 +0000 (16:40 +0200)] 
GHA: drop quictls 3.3.0 builds in favor of openssl 3.5+

- http3-linux: move local nghttpx (nghttp2) build to openssl (from
  quictls). Also tried LibreSSL, but it made some HTTP/2 tests fails.

- http3-linux: drop quictls ngtcp2 build.

- http3-linux: build local openssl with `no-deprecated`.
  (previously tested in the quictls local build.)

- http3-linux: explicitly disable LDAP in cmake openssl jobs.
  cmake builds auto-detect OpenLDAP (autotools don't), and when enabled,
  linking curl fails because system `libsasl.so` requires MD5 openssl
  functions, which are missing from openssl no-deprecated builds.

- macos: move options tested in quictls jobs to other ones.

- linux: drop unused quictls local build. (it was used for msh3.)
  Follow-up to 91138b014d960d2ef6ce9cd0ca237d0220b2458d #17729

- renovate: drop quictls bump detection.

Closes #18833

2 months agoexamples: fix two build issues surfaced with WinCE
Viktor Szakats [Sat, 4 Oct 2025 02:33:49 +0000 (04:33 +0200)] 
examples: fix two build issues surfaced with WinCE

Both may apply to rare non-WinCE Windows builds too.

- fix gcc 4.4.0 preprocessor error:
  ```
  docs/examples/http2-upload.c:43:8: error: "_MSC_VER" is not defined
  ```
  Ref: https://github.com/curl/curl/actions/runs/18238150607/job/51935502616

- fix wrong header order:
  Inlcude `windows.h` after `winsock2.h` via `curl/curl.h`.

Regressions from 45438c8d6f8e70385d66c029568524e9e803c539 #18823

Closes #18843

2 months agoexamples: drop unused `curl/mprintf.h` includes
Viktor Szakats [Sat, 4 Oct 2025 02:51:19 +0000 (04:51 +0200)] 
examples: drop unused `curl/mprintf.h` includes

Follow-up to 45438c8d6f8e70385d66c029568524e9e803c539 #18823

Closes #18842

2 months agoopenssl: fix build for v1.0.2
Viktor Szakats [Sat, 4 Oct 2025 02:12:17 +0000 (04:12 +0200)] 
openssl: fix build for v1.0.2

```
lib/vtls/openssl.c: In function 'asn1_object_dump':
lib/vtls/openssl.c:299:42: error: passing argument 3 of 'i2t_ASN1_OBJECT' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  299 |   int i = i2t_ASN1_OBJECT(buf, (int)len, a);
      |                                          ^
In file included from /home/runner/djgpp/include/openssl/objects.h:965,
                 from /home/runner/djgpp/include/openssl/evp.h:94,
                 from /home/runner/djgpp/include/openssl/x509.h:73,
                 from /home/runner/djgpp/include/openssl/ssl.h:156,
                 from lib/curl_ntlm_core.c:71,
                 from bld/lib/CMakeFiles/libcurl_static.dir/Unity/unity_0_c.c:88:
/home/runner/djgpp/include/openssl/asn1.h:921:58: note: expected 'ASN1_OBJECT *' {aka 'struct asn1_object_st *'} but argument is of type 'const ASN1_OBJECT *' {aka 'const struct asn1_object_st *'}
  921 | int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a);
      |                                             ~~~~~~~~~~~~~^
```
Ref: https://github.com/curl/curl/actions/runs/18236773678/job/51931937131?pr=18039

Follow-up to bb46d42407cd0503a9c499b4646af594a4db4947 #18647

Closes #18841

2 months agolib: drop unused include and duplicate guards
Viktor Szakats [Sat, 4 Oct 2025 01:11:09 +0000 (03:11 +0200)] 
lib: drop unused include and duplicate guards

Closes #18839

2 months agotests: stop overriding system printf symbols
Viktor Szakats [Thu, 2 Oct 2025 14:01:15 +0000 (16:01 +0200)] 
tests: stop overriding system printf symbols

To make the source code match the functions called at runtime.
And to avoid the preprocessor trick that may introduces build issues.

Before this patch, libtests, tunits and units were calling a mixture
of curl and system printf calls, then transformed them all to curl
printf calls by including `curl_printf.h`.

Changes made:
- tests: stop including `curl_printf.h`.
- libtest: switch a couple of outlier system printf calls to curl
  printf.
- unit: use more curl printf to avoid casts and show whole values.
- unit: switch remaining calls to curl printf explicitly.
- tunit: switch to call curl printf explicitly.
- libtest, tunit, unit: ban system printf.
- unit1307, unit1607, unit1609, unit1652, unit1655, unit3214: bump
  types/masks to avoid casts.

After this patch:
- libtests, tunits, units: use exclusively curl printf.
  (as before, but explicitly, without relying on redefinitions.)
- servers: is unchanged (it can only use system printf).

Closes #18814

2 months agochecksrc: reduce directory-specific exceptions
Viktor Szakats [Thu, 2 Oct 2025 19:33:48 +0000 (21:33 +0200)] 
checksrc: reduce directory-specific exceptions

By making them defaults, then fixing and/or reshuffling remaining
exceptions as necessary.

- checksrc: ban by default: `snprintf`, `vsnprintf`, `sscanf`, `strtol`.
- examples: replace `strtol` with `atoi` to avoid a checksrc exception.
- tests/libtest: replace `strtol` with `atol`.
- tests/server: replace most `strtol` with `atol`.
- tests/server: replace most `strtoul` with `atol`/`atoi`.
- tests/server: drop no longer used `util_ultous`.
- fix typo in checksrc rules: `vsnprint` -> `vsnprintf`.
- update local exceptions.

Also:
- examples: ban curl printf functions. They're discouraged in user code.
- examples: replace curl printf with system printf.
  Add `snprintf` workaround for <VS2015.
- examples/synctime: fix `-Wfloat-equal`.
- examples/synctime: exclude for non-Windows and non-UWP Windows.
- examples/synctime: build by default.

Closes #18823

2 months agochecksrc: fix to handle `)` predecing a banned function
Viktor Szakats [Fri, 3 Oct 2025 01:12:39 +0000 (03:12 +0200)] 
checksrc: fix to handle `)` predecing a banned function

Fixing:
```
Unmatched ) in regex; marked by <-- HERE in m/  \*buffer_len = \(ssize_t) <-- HERE
  strtol\(/ at /home/runner/work/curl/curl/scripts/checksrc.pl line 916, <$R> line 380.
```
Ref: https://github.com/curl/curl/actions/runs/18209824275/job/51848079550#step:3:5

Also add a test case.

Follow-up to 684f4cdd3ef0cc41c547fce0e45d8a059a3058b3 #18779
Cherry-picked from #18823
Closes #18836

2 months agoGHA: update dependency google/boringssl to v0.20251002.0
renovate[bot] [Fri, 3 Oct 2025 15:54:06 +0000 (15:54 +0000)] 
GHA: update dependency google/boringssl to v0.20251002.0

Closes #18834

2 months agoMakefile.example: fix option order [ci skip]
Viktor Szakats [Fri, 3 Oct 2025 19:15:33 +0000 (21:15 +0200)] 
Makefile.example: fix option order [ci skip]

The `ld` linker is sensitive to this, and did not find libcurl symbol
with the order before this patch. Seen with mingw-w64 gcc.

Follow-up to f6ddc1fc1e25ff8ea866f90942719af898d0ef0c #18554

Closes #18835

2 months agodoh: inherit new custom ssl flags
Stefan Eissing [Fri, 3 Oct 2025 12:15:04 +0000 (14:15 +0200)] 
doh: inherit new custom ssl flags

The new custom_* flags in the SSL config need to be inherited when
setting up the doh easy handle, so that defaults apply the same way as
for the original easy handle.

Closes #18831

2 months agoGHA: show full versions next to pinned actions
Viktor Szakats [Fri, 3 Oct 2025 12:27:28 +0000 (14:27 +0200)] 
GHA: show full versions next to pinned actions

Also quotes to a configuration entry.

Follow-up to 2e5993ab0812fd1a983738f6d6efbc7bb0806144 #18827

Closes #18832