]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
3 weeks agoexamples/websocket: fix use of uninitialized rlen
Daniel Stenberg [Fri, 17 Oct 2025 07:31:55 +0000 (09:31 +0200)] 
examples/websocket: fix use of uninitialized rlen

Pointed out by ZeroPath

Closes #19088

3 weeks agoopenldap: limit max incoming size
Daniel Stenberg [Thu, 16 Oct 2025 19:47:42 +0000 (21:47 +0200)] 
openldap: limit max incoming size

Set the maximum allowed size of an incoming LDAP message, which to
OpenLDAP means that it allows malloc() up to this size. If not set,
there is no limit and we instead risk a malloc() failure.

The limit is arbitrarily set to 256K as I can't figure out what a
reasonable value should be.

OpenLDAP docs: https://openldap.org/software/man.cgi?query=lber-sockbuf&apropos=0&sektion=0&manpath=OpenLDAP+2.6-Release&arch=default&format=html

Bug: https://issues.oss-fuzz.com/issues/432441303
Closes #19087

3 weeks agofirefox-db2pem.sh: add macOS support, tidy-ups
Viktor Szakats [Wed, 15 Oct 2025 17:46:35 +0000 (19:46 +0200)] 
firefox-db2pem.sh: add macOS support, tidy-ups

Cherry-picked from #19076
Closes #19086

3 weeks agoscripts: pass `--` before passing xargs
Viktor Szakats [Wed, 15 Oct 2025 17:45:48 +0000 (19:45 +0200)] 
scripts: pass `--` before passing xargs

Also:
- GHA/checkdocs: escape `.` in -E regex expression.

Closes #19076

3 weeks agoGHA: sync up `curl -V` step descriptions
Viktor Szakats [Wed, 15 Oct 2025 18:22:20 +0000 (20:22 +0200)] 
GHA: sync up `curl -V` step descriptions

Also to make it easier to recognize.

Also:
- GHA/linux-old: split steps to match other jobs.
- GHA: add `--disable` where missing.

Closes #19084

3 weeks agoGHA/windows: stop installing Perl `Win32-Process*` modules
Viktor Szakats [Thu, 16 Oct 2025 16:10:41 +0000 (18:10 +0200)] 
GHA/windows: stop installing Perl `Win32-Process*` modules

It's complex and did not help stabilizing CI runs.

Hard to say, but I'm suspicious it's related to the CI errors
-1073741502, 0xC0000142, seen in the 'build examples' and
'disk space used' steps.

Ref: #18526
Reverts 52775a7fb4ba63d66d60067dea4a5293fb7c55a1 #18296
Closes #19083

3 weeks agoGHA: bump LibreSSL to 4.2.0
Viktor Szakats [Thu, 16 Oct 2025 14:29:56 +0000 (16:29 +0200)] 
GHA: bump LibreSSL to 4.2.0

Also move back URLs to GitHub, sources are available there again.

Ref: https://github.com/libressl/portable/releases/tag/v4.2.0
Ref: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-4.2.0-relnotes.txt
Ref: #19050
Ref: #19081

Closes #19082

3 weeks agoversion: add GSS backend name and version
Viktor Szakats [Wed, 15 Oct 2025 13:06:08 +0000 (15:06 +0200)] 
version: add GSS backend name and version

MIT Kerberos version detection is implemented for autotools and cmake.

Examples:
```
curl 8.17.0-DEV (x86_64-pc-linux-gnu) ... mbedTLS/3.6.4 libidn2/2.3.7 nghttp2/1.59.0 libgss/1.0.4 OpenLDAP/2.6.7
curl 8.17.0-DEV (x86_64-pc-linux-gnu) ... LibreSSL/4.1.1 libidn2/2.3.7 nghttp2/1.59.0 mit-krb5/1.20.1 OpenLDAP/2.6.7
curl 8.17.0-DEV (x86_64-pc-linux-gnu) ... LibreSSL/4.1.1 libidn2/2.3.7 nghttp2/1.59.0 mit-krb5 OpenLDAP/2.6.7
curl 8.17.0-DEV (x86_64-pc-linux-gnu) ... LibreSSL/4.1.1 nghttp2/1.59.0 mit-krb5/1.20.1 OpenLDAP/2.6.7
curl 8.17.0-DEV (aarch64e-apple-darwin24.6.0) ... GnuTLS/3.8.10 libidn2/2.3.8 libssh2/1.11.1 nghttp2/1.67.1 mit-krb5/1.22.1
```

Also:
- cmake/FindGSS: strip project name ("Kerberos 5 release") from
  the version string when detected via `krb5-config`.

Closes #19073

3 weeks agoautotools: drop detection of ancient OpenSSL libs `RSAglue` and `rsaref`
Viktor Szakats [Thu, 16 Oct 2025 03:33:12 +0000 (05:33 +0200)] 
autotools: drop detection of ancient OpenSSL libs `RSAglue` and `rsaref`

Closes #19078

3 weeks agoapple sectrust: add to features
Stefan Eissing [Tue, 14 Oct 2025 10:13:24 +0000 (12:13 +0200)] 
apple sectrust: add to features

It should be visible in the feature list that libcurl is build with
Apple SecTrust enabled.

Closes #19057

3 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 16 Oct 2025 07:01:17 +0000 (09:01 +0200)] 
RELEASE-NOTES: synced

3 weeks agoconnect: remove redundant condition in shutdown start
Daniel Stenberg [Thu, 16 Oct 2025 06:32:57 +0000 (08:32 +0200)] 
connect: remove redundant condition in shutdown start

Pointed out by CodeSonar

Closes #19079

3 weeks agourldata: make redirect counter 16 bit
Daniel Stenberg [Wed, 15 Oct 2025 08:56:47 +0000 (10:56 +0200)] 
urldata: make redirect counter 16 bit

Instead of long (up to 64-bit) as the maximum allowed value set since
b059f7deaf3 is 0x7fff. Saves 2 or 6 bytes.

Closes #19072

3 weeks agourldata: make 'retrycount' a single byte
Daniel Stenberg [Wed, 15 Oct 2025 08:48:42 +0000 (10:48 +0200)] 
urldata: make 'retrycount' a single byte

Since it only counts up to 5

Closes #19071

3 weeks agolib: stop NULL-checking conn->passwd and ->user
Daniel Stenberg [Tue, 14 Oct 2025 12:43:46 +0000 (14:43 +0200)] 
lib: stop NULL-checking conn->passwd and ->user

They always point to a string. The string might be zero length.

Closes #19059

3 weeks agotransfer: reset retry count on each request
Emre Çalışkan [Tue, 14 Oct 2025 18:35:54 +0000 (21:35 +0300)] 
transfer: reset retry count on each request

Reported-by: plv1313 on github
Fixes #18926
Closes #19066

3 weeks agoquic: remove data_idle handling
Stefan Eissing [Tue, 14 Oct 2025 13:53:37 +0000 (15:53 +0200)] 
quic: remove data_idle handling

The transfer loop used to check the socket and if no poll events
were seen, triggered a "DATA_IDLE" event into the filters to let
them schedule times/do things anyway.

Since we no longer check the socket, the filters have been called
already and the DATA_IDLE event is unnecessary work. Remove it.

Closes #19060

3 weeks agotftp: check for trailing ";mode=" in URL without strstr
Daniel Stenberg [Wed, 15 Oct 2025 06:42:20 +0000 (08:42 +0200)] 
tftp: check for trailing ";mode=" in URL without strstr

RFC 3617 defines two specific modes, "netascii" and "octet". This code
now checks only for those trailing ones - and not in the hostname since
they can't be there anymore.

Assisted-by: Jay Satiro
Closes #19070

3 weeks agoftp: replace strstr() in ;type= handling
Daniel Stenberg [Wed, 15 Oct 2025 06:27:48 +0000 (08:27 +0200)] 
ftp: replace strstr() in ;type= handling

Since it needs to be a trailing piece of the path avoiding strstr() is
faster and more reliable.

Also stopped checking the host name since it cannot actually be there
since quite a long while back. The URL parser doesn't allow such a
hostname.

Moved the check into its own subfunction too.

Closes #19069

3 weeks agolib: reduce use of data->conn->
Daniel Stenberg [Tue, 14 Oct 2025 15:40:18 +0000 (17:40 +0200)] 
lib: reduce use of data->conn->

If there are more than two of them in a function, use a local 'conn'
variable instead.

Closes #19063

3 weeks agohttp: look for trailing 'type=' in ftp:// without strstr
Daniel Stenberg [Tue, 14 Oct 2025 16:08:27 +0000 (18:08 +0200)] 
http: look for trailing 'type=' in ftp:// without strstr

- it could find a wrong string
- this is faster

Closes #19065

3 weeks agows: fix type conversion check
Jay Satiro [Sun, 12 Oct 2025 22:35:22 +0000 (18:35 -0400)] 
ws: fix type conversion check

- Fix logic that checks whether a size_t will fit in a curl_off_t.

Reported-by: Viktor Szakats
Fixes https://github.com/curl/curl/issues/19017
Closes https://github.com/curl/curl/pull/19036

3 weeks agotool_operate: retry on HTTP response codes 522 and 524
Jay Satiro [Fri, 10 Oct 2025 19:42:27 +0000 (15:42 -0400)] 
tool_operate: retry on HTTP response codes 522 and 524

- Treat HTTP response codes 522 and 524 as a transient error since
  Cloudflare may use them instead of 504 to signal timeout.

For example here is a 522 error message from Cloudflare:

"The initial connection between Cloudflare's network and the origin web
server timed out. As a result, the web page can not be displayed."

Prior to this change the curl tool did not retry on HTTP response codes
522 and 524 when --retry was used.

Fixes https://github.com/curl/curl/discussions/16143
Closes https://github.com/curl/curl/pull/19011

3 weeks agoexamples: check more errors, fix cleanups, scope variables
Viktor Szakats [Mon, 13 Oct 2025 20:57:01 +0000 (22:57 +0200)] 
examples: check more errors, fix cleanups, scope variables

Inspired by Joshua's report on examples.

Closes #19055

3 weeks agoopenldap: explain a const removing typecast
Daniel Stenberg [Tue, 14 Oct 2025 08:49:53 +0000 (10:49 +0200)] 
openldap: explain a const removing typecast

Closes #19056

3 weeks agoscorecard: add perf support on linux
Stefan Eissing [Tue, 14 Oct 2025 12:39:50 +0000 (14:39 +0200)] 
scorecard: add perf support on linux

When calling scorecard with --flame to produce a flamegraph, use
"perf" on linux platforms to do the measurements. Update the scorecard
documentation about it.

Closes #19058

3 weeks agoexamples: improve global init, error checks and returning errors
Viktor Szakats [Mon, 13 Oct 2025 14:30:18 +0000 (16:30 +0200)] 
examples: improve global init, error checks and returning errors

- add `curl_global_init()` and `curl_global_cleanup()` where missing.
- check the result of `curl_global_init()` where missing.
- return the last curl error from `main()`.
- drop Win32-specific socket initialization in favor of `curl_global_init()`.
- rename some outliers to `res` for curl result code.
- fix cleanup in some error cases.

Inspired by Joshua's report on examples.

Closes #19053

3 weeks agoexamples: return `curl_easy_perform()` results
Viktor Szakats [Mon, 13 Oct 2025 14:18:40 +0000 (16:18 +0200)] 
examples: return `curl_easy_perform()` results

Where missing. Or explicitly `(void)` it where we ignore it on purpose.

Reported-by: Joshua Rogers (for `sepheaders.c`)
Closes #19052

3 weeks agoexamples: call `curl_global_cleanup()` where missing
Viktor Szakats [Mon, 13 Oct 2025 14:08:42 +0000 (16:08 +0200)] 
examples: call `curl_global_cleanup()` where missing

Reported-by: Joshua Rogers (for `sepheaders.c`)
Closes #19051

3 weeks agochecksrc: allow disabling warnings on FIXME/TODO comments
Viktor Szakats [Mon, 13 Oct 2025 11:44:23 +0000 (13:44 +0200)] 
checksrc: allow disabling warnings on FIXME/TODO comments

Follow-up to 71ace9f3c16a434385fc27b3e8bffb52deb6ccd1

Closes #19048

3 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 13 Oct 2025 14:03:46 +0000 (16:03 +0200)] 
RELEASE-NOTES: synced

3 weeks agolibssh2: avoid risking using an uninitialized local struct field
Daniel Stenberg [Mon, 13 Oct 2025 07:40:38 +0000 (09:40 +0200)] 
libssh2: avoid risking using an uninitialized local struct field

Reported-by: Joshua Rogers
Closes #19043

3 weeks agolibssh: catch a resume point larger than the size
Daniel Stenberg [Mon, 13 Oct 2025 07:45:28 +0000 (09:45 +0200)] 
libssh: catch a resume point larger than the size

As it would otherwise trigger broken math

Reported-by: Joshua Rogers
Closes #19044

3 weeks agoREUSE: move copyright headers to `.checksrc`
Viktor Szakats [Sat, 11 Oct 2025 08:48:23 +0000 (10:48 +0200)] 
REUSE: move copyright headers to `.checksrc`

To make it simpler to move them around, create and delete them without
syncing with `REUSE.toml`.

Also:
- checksrc: allow empty lines in `.checksrc`.
- comment on why curl printfs are disallowed in examples.

Closes #19024

3 weeks agolibssh2: fix EAGAIN return in ssh_state_auth_agent
Daniel Stenberg [Mon, 13 Oct 2025 07:36:08 +0000 (09:36 +0200)] 
libssh2: fix EAGAIN return in ssh_state_auth_agent

Reported-by: Joshua Rogers
Closes #19042

3 weeks agosocks_sspi: remove the enforced mode clearing
Daniel Stenberg [Mon, 13 Oct 2025 07:24:57 +0000 (09:24 +0200)] 
socks_sspi: remove the enforced mode clearing

Reported-by: Joshua Rogers
Closes #19040

3 weeks agopop3: function could get the ->transfer field wrong
Daniel Stenberg [Mon, 13 Oct 2025 06:41:38 +0000 (08:41 +0200)] 
pop3: function could get the ->transfer field wrong

In pop3_perform(), pop3->transfer was derived from the old
data->req.no_body. Then, pop3_perform_command() re-computed
data->req.no_body.

Now we instead call pop3_perform_command() first.

Reported-by: Joshua Rogers
Closes #19039

3 weeks agotool_getparam: make --fail and --fail-with-body override each other
Daniel Stenberg [Sun, 12 Oct 2025 13:58:43 +0000 (15:58 +0200)] 
tool_getparam: make --fail and --fail-with-body override each other

This allows users to put one of them in their .curlrc and still easily
use the other one at will in command lines.

The --no-* versions disable both of them.

Reported-by: Mitchell Blank Jr
Fixes #19029
Closes #19034

3 weeks agotool_msgs: make errorf() show if --show-error
Daniel Stenberg [Sun, 12 Oct 2025 21:48:14 +0000 (23:48 +0200)] 
tool_msgs: make errorf() show if --show-error

Assisted-by: Mitchell Blank Jr
Ref: #19029
Closes #19035

3 weeks agoKNOWN_BUGS: We do not support auth-int for Digest using PUT or POST
Daniel Stenberg [Mon, 13 Oct 2025 06:27:01 +0000 (08:27 +0200)] 
KNOWN_BUGS: We do not support auth-int for Digest using PUT or POST

Closes #19038

3 weeks agotftp: error requests for blank filenames
Daniel Stenberg [Sun, 12 Oct 2025 09:38:39 +0000 (11:38 +0200)] 
tftp: error requests for blank filenames

Reported-by: Joshua Rogers
Closes #19033

3 weeks agoexamples/synctime: fix null termination assumptions
Daniel Stenberg [Sun, 12 Oct 2025 09:24:07 +0000 (11:24 +0200)] 
examples/synctime: fix null termination assumptions

bonus: dont parse argv[0] for options

Reported-by: Joshua Rogers
Closes #19032

3 weeks agosws: pass in socket reference to allow function to close it
Daniel Stenberg [Sun, 12 Oct 2025 09:15:08 +0000 (11:15 +0200)] 
sws: pass in socket reference to allow function to close it

The function service_connection() now passes in a reference to the
socket instead of by value since the sub function http_connect() might
close it and set *infdp = CURL_SOCKET_BAD. This would previously not be
detected when service_connection() returned and potentially cause a
double close of the socket.

Reported-by: Joshua Rogers
Closes #19031

3 weeks agolibssh/libssh2: reject quote command lines with too much data
Daniel Stenberg [Sun, 12 Oct 2025 09:05:46 +0000 (11:05 +0200)] 
libssh/libssh2: reject quote command lines with too much data

If there is lingering letters left on the right side after the paths
have been parsed, they are syntactically incorrect so returning error is
the safe thing to do.

Reported-by: Harry Sintonen
Closes #19030

3 weeks agodocs: expand on quoting rules for file names in SFTP quote
Daniel Stenberg [Sat, 11 Oct 2025 20:44:30 +0000 (22:44 +0200)] 
docs: expand on quoting rules for file names in SFTP quote

Reported-by: Harry Sintonen
Closes #19025

3 weeks agolib: SSL connection reuse
Stefan Eissing [Fri, 10 Oct 2025 12:33:36 +0000 (14:33 +0200)] 
lib: SSL connection reuse

Protocol handlers not flagging PROTOPT_SSL that allow reuse of existing
SSL connections now need to carry the flag PROTOPT_SSL_REUSE.

Add PROTOPT_SSL_REUSE to imap, ldap, pop3, smtp and ftp.

Add tests the http: urls do not reuse https: connections and vice versa.

Reported-by: Sakthi SK
Fixes #19006
Closes #19007

3 weeks agolibssh2: use sockindex consistently
Stefan Eissing [Fri, 10 Oct 2025 10:00:29 +0000 (12:00 +0200)] 
libssh2: use sockindex consistently

Although the protocol should only run on index 0, there was a mix of
looked up sockindex and using constant 0 in tls send/recv.

Reported-by: Joshua Rogers
Closes #19004

3 weeks agosmb: transfer debugassert to real check
Stefan Eissing [Fri, 10 Oct 2025 09:28:29 +0000 (11:28 +0200)] 
smb: transfer debugassert to real check

That also works for non-debug builds.

Reported-by: Joshua Rogers
Cloes #19003

3 weeks agolib1514: fix return code mixup
Daniel Stenberg [Sat, 11 Oct 2025 21:34:45 +0000 (23:34 +0200)] 
lib1514: fix return code mixup

Reported-by: Joshua Rogers
Closes #19027

3 weeks agosocksd: remove --bindonly mention, there is no such option
Daniel Stenberg [Sat, 11 Oct 2025 20:54:54 +0000 (22:54 +0200)] 
socksd: remove --bindonly mention, there is no such option

Reported-by: Joshua Rogers
Closes #19026

3 weeks agoasyn-ares: remove wrong comment about the callback argument
Daniel Stenberg [Fri, 10 Oct 2025 21:54:15 +0000 (23:54 +0200)] 
asyn-ares: remove wrong comment about the callback argument

Both the c-ares documentation and the c-ares source code contradict the
previous comment (and mentions/contains no such restriction).

Ref: #19001
Closes #19014

3 weeks agodoswin: CloseHandle the thread on shutdown
Daniel Stenberg [Fri, 10 Oct 2025 07:53:32 +0000 (09:53 +0200)] 
doswin: CloseHandle the thread on shutdown

As this is in the tool shutdown the impact of it was nothing.

Also, move two global variables to local.

Follow-up to 9a2663322c330ff11275abafd612e9c

Reported-by: Joshua Rogers
Closes #18996

3 weeks agoRELEASE-NOTES: synced rc-8_17_0-1
Daniel Stenberg [Sat, 11 Oct 2025 13:44:10 +0000 (15:44 +0200)] 
RELEASE-NOTES: synced

4 weeks agoexamples/log_failed_transfers: make it build for WinCE
Viktor Szakats [Fri, 10 Oct 2025 22:27:36 +0000 (00:27 +0200)] 
examples/log_failed_transfers: make it build for WinCE

- include `windows.h` after `winsock2.h` via `curl/curl.h`.
- avoid `errno` for WinCE.
- avoid `_vscprintf` for WinCE.

Ref: 4535532ed36d2129b107ab357262072f82c2b34a #18843
Follow-up to 0780de2625bf8bb3bcb0f88bbbc401b2750ec1bb #18668
Closes #19016

4 weeks agocurl_threads: delete WinCE fallback branch
Viktor Szakats [Fri, 10 Oct 2025 22:11:16 +0000 (00:11 +0200)] 
curl_threads: delete WinCE fallback branch

Both WinCE and Windows use `CreateThread()` now, so the use of
`GetLastError()` works for both.

Follow-up to 03448f477a0cfa3868dfd15a7b9278dcecf944a2 #18998
Follow-up to 1c49f2f26d0f200bb9de61f795f06a1bc56845e9 #18451
Follow-up to af0216251b94e751baa47146ac9609db70793b8e #1589

Closes #19015

4 weeks agocmake: pre-fill three more type sizes on Windows
Viktor Szakats [Fri, 10 Oct 2025 21:11:14 +0000 (23:11 +0200)] 
cmake: pre-fill three more type sizes on Windows

Use `CMAKE_SIZEOF_VOID_P` to fill the size of three types that differ
on 32 and 64-bit Windows: `curl_socket_t`, `size_t`, and on mingw-w64:
`ssize_t`.

`time_t` remains the only type needing detection at configuration time,
with MSVC or mingw-w64.

Ref: https://cmake.org/cmake/help/v4.1/variable/CMAKE_SIZEOF_VOID_P.html

Closes #19013

4 weeks agocmake/FindGSS: simplify/de-dupe lib setup
Viktor Szakats [Fri, 10 Oct 2025 20:57:10 +0000 (22:57 +0200)] 
cmake/FindGSS: simplify/de-dupe lib setup

- lib name is always `gss` with GNU GSS.
- move lib name assigments to the detection blocks.

Closes #19012

4 weeks agoos400: document threads handling in code.
Patrick Monnerat [Fri, 10 Oct 2025 13:55:50 +0000 (15:55 +0200)] 
os400: document threads handling in code.

This is to clarify threads unavaibility check and handling for security
bug busters unaware of OS400 specificities.

Fixes #18967
Closes #19009

4 weeks agoc-ares: when resolving failed, persist error
Stefan Eissing [Fri, 10 Oct 2025 08:40:55 +0000 (10:40 +0200)] 
c-ares: when resolving failed, persist error

Repeated calls to `Curl_async_is_resolved()` after a failure
returned OK and not the error that was the result of the resolve
fail.

Reported-by: Joshua Rogers
Closes #18999

4 weeks agothread: errno on thread creation
Stefan Eissing [Fri, 10 Oct 2025 08:15:38 +0000 (10:15 +0200)] 
thread: errno on thread creation

When thread creation fails, the code uses `errno` to remember the cause.
But pthread_create() never sets errno and gives the error as return value.
Fix that by setting the return value into errno on failure.

Windows: I think the ifdef was the wrong way around. Also set a generic
Windows Error code on CE systems.

Reported-by: Joshua Rogers
Closes #18998

4 weeks agoconn: fix hostname move on connection reuse
Stefan Eissing [Fri, 10 Oct 2025 07:48:52 +0000 (09:48 +0200)] 
conn: fix hostname move on connection reuse

When reusing a connection, the `host` and `conn_to_host` hostname
structs are moved from the template connection onto the existing one.

There was a NULLing of a tempplate member missing in `conn_to_host`
which could then lead to a double free.

Make this struct move into a static function, doing the correct
thing for both `struct hostname` in a connection.

Reported-by: Joshua Rogers
Closes #18995

4 weeks agocf-socket: set FD_CLOEXEC on all sockets opened
Stefan Eissing [Thu, 9 Oct 2025 10:19:49 +0000 (12:19 +0200)] 
cf-socket: set FD_CLOEXEC on all sockets opened

Removed TODO item

Reported-by: Joshua Rogers
Closes #18968

4 weeks agows: fix some edge cases
Stefan Eissing [Thu, 9 Oct 2025 09:23:42 +0000 (11:23 +0200)] 
ws: fix some edge cases

Fix edge cases around handling of pending send frames and encoding
frames with size_t/curl_off_t possible flowy things.

Reported-by: Joshua Rogers
Closes #18965

4 weeks agognutls: check conversion of peer cert chain
Stefan Eissing [Thu, 9 Oct 2025 08:41:02 +0000 (10:41 +0200)] 
gnutls: check conversion of peer cert chain

Check the result when converting the peer certificate chain
into gnutls internal x590 data structure for errors.

Reported-by: Joshua Rogers
Closes #18964

4 weeks agosocks: advance iobuf instead of reset
Stefan Eissing [Wed, 8 Oct 2025 12:29:54 +0000 (14:29 +0200)] 
socks: advance iobuf instead of reset

During the SOCKS connect phase, the `iobuf` is used to receive repsonses
from the server. If the server sends more bytes than expected, the code
discarded them silently.

Fix this by advancing the iobuf only with the length consumed.

Reported-by: Joshua Rogers
Closes #18938

4 weeks agocmake/FindGSS: dedupe pkg-config module strings
Viktor Szakats [Fri, 10 Oct 2025 04:43:41 +0000 (06:43 +0200)] 
cmake/FindGSS: dedupe pkg-config module strings

Closes #18994

4 weeks agocmake/FindGSS: drop wrong header check for GNU GSS
Viktor Szakats [Fri, 10 Oct 2025 04:37:45 +0000 (06:37 +0200)] 
cmake/FindGSS: drop wrong header check for GNU GSS

GNU GSS offers `gss.h`; do not check for `gssapi.h`. `gssapi.h`
was originally published by Heimdal, and later MIT Kerberos also added it
for Heimdal compatibility.

Closes #18993

4 weeks agokerberos: bump minimum to 1.3 (2003-07-08), drop legacy logic
Viktor Szakats [Fri, 10 Oct 2025 01:09:16 +0000 (03:09 +0200)] 
kerberos: bump minimum to 1.3 (2003-07-08), drop legacy logic

Previous minimum was: 1.2.4 (2002-02-28)

- assume `gssapi/gssapi.h` header for MIT Kerberos.

  Drop logic detecting this header, and drop alternate logic including
  a bare "gssapi.h". Bare `gssapi.h` is Heimdal-specific. MIT Kerberos
  added support for it for Heimdal compatibility on 2006-11-09,
  redirecting to `gssapi/gssapi.h`. MIT Kerberos supported the latter
  header in the 1990s already.

  Ref: 40e1a016f92903c731f07325bc1f9c6416ae1ac3 (2008-03-06)
  Ref: https://github.com/krb5/krb5/commit/d11935200186040132e05e2beaaba20a770ee3ef (2006-11-09)

- configure.ac: stop using `HAVE_GSSAPI_GSSAPI_H`.

  Added in 2010 to support "ancient distros such as RHEL-3" where
  `gssapi/gssapi_krb5.h` did not include `gssapi/gssapi.h`.

  MIT Kerberos includes it since commit:
  https://github.com/krb5/krb5/commit/d9e959edfa8da7cab3bde96c9c4ca39beaf8db69 (2003-03-06)
  Released in 1.3 (2003-07-08).

  Bump minimum required version to avoid this issue.

  Reverts cca192e58f9ed7c4b33c1c991f69ff830c58b38f (2010-04-16)

Ref: https://web.mit.edu/kerberos/dist/historic.html
Ref: https://sources.debian.org/src/krb5/

Closes #18992

4 weeks agoCI.md: refresh
Viktor Szakats [Thu, 9 Oct 2025 11:34:56 +0000 (13:34 +0200)] 
CI.md: refresh

Closes #18973

4 weeks agoGHA/linux: test GNU GSS with autotools, cmake, valgrind and scan-build
Viktor Szakats [Fri, 10 Oct 2025 12:37:41 +0000 (14:37 +0200)] 
GHA/linux: test GNU GSS with autotools, cmake, valgrind and scan-build

The cmake build is running runtests with valgrind. The autotools one is
running scan-build.

Also:
- ignore two memleaks with GNU GSS detected by valgrind.
- add comment on support status of `GSS_C_DELEG_POLICY_FLAG`.

Closes #19008

4 weeks agokerberos: stop including `gssapi/gssapi_generic.h`
Viktor Szakats [Fri, 10 Oct 2025 00:49:46 +0000 (02:49 +0200)] 
kerberos: stop including `gssapi/gssapi_generic.h`

It's a legacy MIT Kerberos header that's no longer used by curl since:
355bf01c828af16c47ab52bccb9ade769f8bf158 (2015-01-09)

There were still mentions of it after this patch, when using versions
<1.2.3, but those versions aren't supported since:
99185417952da30c8ddd82ab962fb58da96260b2 (2008-06-12)

This header remains in use by autotools and cmake to detect MIT Kerberos
(vs. Heimdal, which doesn't have it.)

Ref: https://github.com/curl/curl/pull/18978#issuecomment-3387414995

Closes #18990

4 weeks agolibssh: make atime and mtime cap the timestamp instead of wrap
Daniel Stenberg [Thu, 9 Oct 2025 21:21:37 +0000 (23:21 +0200)] 
libssh: make atime and mtime cap the timestamp instead of wrap

The libssh API uses a 32 bit type for datestamp, so instead of just
force-typecast it, make sure it gets capped at UINT_MAX if the value is
larger.

Reported-by: Joshua Rogers
Closes #18989

4 weeks agoldap: avoid null ptr deref on failure
Daniel Stenberg [Thu, 9 Oct 2025 21:03:18 +0000 (23:03 +0200)] 
ldap: avoid null ptr deref on failure

ldap_get_dn() can return NULL on error

Reported-by: Joshua Rogers
Closes #18988

4 weeks agokerberos: drop logic for MIT Kerberos <1.2.3 (pre-2002) versions
Viktor Szakats [Thu, 9 Oct 2025 15:15:02 +0000 (17:15 +0200)] 
kerberos: drop logic for MIT Kerberos <1.2.3 (pre-2002) versions

curl requires 1.2.4 or newer.

Also:
- vms: stop defining `gss_nt_service_name`. Added in
  f9cf3de70b3a494f627eda6cccf6607616eaf449, symbol not used in curl code
  since 355bf01c828af16c47ab52bccb9ade769f8bf158.

Closes #18978

4 weeks agoopenldap: fix memory-leak on oldap_do's exit path
Daniel Stenberg [Thu, 9 Oct 2025 20:57:29 +0000 (22:57 +0200)] 
openldap: fix memory-leak on oldap_do's exit path

On SSL sockbuf setup failure in `oldap_do`, the 'lud' data would not be
freed and instead leak.

Reported-by: Joshua Rogers
Closes #18986

4 weeks agoopenldap: fix memory-leak in error path
Daniel Stenberg [Thu, 9 Oct 2025 20:50:01 +0000 (22:50 +0200)] 
openldap: fix memory-leak in error path

The 'ber' pointer could escape a free if an early error occurred.

Reported-by: Joshua Rogers
Closes #18985

4 weeks agoftp: simplify the 150/126 size scanner
Daniel Stenberg [Thu, 9 Oct 2025 20:32:09 +0000 (22:32 +0200)] 
ftp: simplify the 150/126 size scanner

The file size is weirdly returned in a 150 or 126 response as "XXX
bytes" mentioned somewhere in the response string. This is a rewrite of
the size scanner to replace the strange strstr() + backwards search from
before with a plain forward search until '[number] + " bytes"' is a
match.

Triggered by a report by Joshua Rogers about the previous parser.

Closes #18984

4 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 9 Oct 2025 20:10:32 +0000 (22:10 +0200)] 
RELEASE-NOTES: synced

4 weeks agoasyn-ares: use the duped hostname pointer for all calls
Daniel Stenberg [Thu, 9 Oct 2025 15:23:56 +0000 (17:23 +0200)] 
asyn-ares: use the duped hostname pointer for all calls

In one c-ares call the passed in pointer was used and not the new
duplicated one. This is probably fine but might as well use the new
pointer as all the other calls do, which will survive longer.

Reported-by: Joshua Rogers
Closes #18980

4 weeks agoCurl_resolv: fix comment. 'entry' argument is not optional
Daniel Stenberg [Thu, 9 Oct 2025 15:17:31 +0000 (17:17 +0200)] 
Curl_resolv: fix comment. 'entry' argument is not optional

Reported-by: Joshua Rogers
Closes #18979

4 weeks agokrb5_gssapi: fix memory leak on error path
Daniel Stenberg [Thu, 9 Oct 2025 14:51:55 +0000 (16:51 +0200)] 
krb5_gssapi: fix memory leak on error path

If a non-compliant amount of bytes is received, the function would
return error without free.

Reported-by: Joshua Rogers
Closes #18976

4 weeks agovauth/digest: improve the digest parser
Daniel Stenberg [Thu, 9 Oct 2025 14:35:39 +0000 (16:35 +0200)] 
vauth/digest: improve the digest parser

Previously, if for example the nonce would end with "realm=" etc it
would get the wrong piece, due to the naive parser.

Reported-by: Joshua Rogers
Closes #18975

4 weeks agoschannel_verify: fix mem-leak in Curl_verify_host
Daniel Stenberg [Thu, 9 Oct 2025 11:18:05 +0000 (13:18 +0200)] 
schannel_verify: fix mem-leak in Curl_verify_host

Reported-by: Stanislav Fort
Closes #18972

4 weeks agoexamples: add an example for logging failed transfers
Jay Satiro [Sat, 20 Sep 2025 02:12:05 +0000 (22:12 -0400)] 
examples: add an example for logging failed transfers

- Add an example that demonstrates per-transfer verbose logging to
  memory.

The transfer's log is written to disk only if the transfer fails.

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

4 weeks agotool_operate: keep failed partial download for retry auto-resume
Jay Satiro [Fri, 18 Oct 2024 18:12:31 +0000 (14:12 -0400)] 
tool_operate: keep failed partial download for retry auto-resume

- Keep data from a failed download instead of discarding it on retry in
  some limited cases when we know it's ok (currently only HTTP 200/206).

Prior to this change on failed transfer the tool truncated any outfile
data written before retrying the transfer. This change adds an exception
for HTTP downloads when the user requested auto-resume, because in that
case we can keep the outfile data and resume from the new position.

Reported-by: tkzv@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/18035
Closes https://github.com/curl/curl/pull/18665

4 weeks agoopenssl: add comments regarding OCSP verification
Stefan Eissing [Thu, 9 Oct 2025 08:26:30 +0000 (10:26 +0200)] 
openssl: add comments regarding OCSP verification

To allow future reviewers of "security" reports to more easily find out
why code is this way.

Closes #18962

4 weeks agomemdup0: handle edge case
Stefan Eissing [Thu, 9 Oct 2025 09:42:43 +0000 (11:42 +0200)] 
memdup0: handle edge case

When length is already SIZE_MAX, fail without allocating.

Reported-by: Joshua Rogers
Closes #18966

4 weeks agorustls: pass the correct result to rustls_failf
Stefan Eissing [Thu, 9 Oct 2025 07:55:38 +0000 (09:55 +0200)] 
rustls: pass the correct result to rustls_failf

Reported-by: Joshua Rogers
Closes #18961

4 weeks agoGHA: rename config files to match pyspelling
Viktor Szakats [Thu, 9 Oct 2025 11:48:06 +0000 (13:48 +0200)] 
GHA: rename config files to match pyspelling

To make it more obvious what needs to be looked at when pyspelling is
reporting an issue.

Follow-up to 95e50ad69473d8229b85478a3f2138b7e632fbe8 #18756
Closes #18974

4 weeks agoexamples: update `.gitignore`
Viktor Szakats [Thu, 9 Oct 2025 10:54:17 +0000 (12:54 +0200)] 
examples: update `.gitignore`

Follow-up to f6f62933e917b8b5c9a9394907ce4b69600214b4 #18264
Closes #18971

4 weeks agoexamples: allow `vsnprintf` again
Viktor Szakats [Thu, 9 Oct 2025 10:51:08 +0000 (12:51 +0200)] 
examples: allow `vsnprintf` again

Ref: https://github.com/curl/curl/pull/18668#issuecomment-3383422410
Follow-up to b12da22db1f11da51082977dc21a7edee7858911 #18866
Closes #18970

4 weeks agoexamples/sessioninfo: do not disable security
Viktor Szakats [Thu, 9 Oct 2025 10:36:43 +0000 (12:36 +0200)] 
examples/sessioninfo: do not disable security

Also make it return the curl result code.

Follow-up to df70a68984308952dcacf33d11593cb22ad80464 #18909
Closes #18969

4 weeks agohostip: don't store negative resolves due unrelated errors
Daniel Stenberg [Thu, 9 Oct 2025 07:07:27 +0000 (09:07 +0200)] 
hostip: don't store negative resolves due unrelated errors

Like for:

- OOM
- resolver_start() returns error
- DoH has problems

Fixes #18953
Fixes #18954
Reported-by: Joshua Rogers
Closes #18958

4 weeks agomk-lib1521: verify the setopt options that accept -1
Daniel Stenberg [Thu, 9 Oct 2025 08:15:41 +0000 (10:15 +0200)] 
mk-lib1521: verify the setopt options that accept -1

4 weeks agosetopt: allow CURLOPT_DNS_CACHE_TIMEOUT set to -1
Daniel Stenberg [Thu, 9 Oct 2025 07:50:20 +0000 (09:50 +0200)] 
setopt: allow CURLOPT_DNS_CACHE_TIMEOUT set to -1

It is documented as valid. Regression from commit b059f7deaf3 shipped in
8.16.0

Reported-by: Andrei Kurushin
Fixes #18959
Closes #18960

4 weeks agotest1582: verify the TLS channel binding cert memory leak fix
Daniel Stenberg [Tue, 7 Oct 2025 07:22:05 +0000 (09:22 +0200)] 
test1582: verify the TLS channel binding cert memory leak fix

4 weeks agoopenssl: fix peer certificate leak in channel binding
Daniel Stenberg [Tue, 7 Oct 2025 05:49:00 +0000 (07:49 +0200)] 
openssl: fix peer certificate leak in channel binding

Reported-by: Stanislav Fort
Bug: https://hackerone.com/reports/3373640
Closes #18917

4 weeks agohttp2: ingress handling edge cases
Stefan Eissing [Wed, 8 Oct 2025 11:06:48 +0000 (13:06 +0200)] 
http2: ingress handling edge cases

Fix some edge cases around the `data_max_bytes` handling when
processing ingress.

Reported-by: Joshua Rogers
Closes #18933

4 weeks agohttp2: cleanup pushed newhandle on fail
Stefan Eissing [Wed, 8 Oct 2025 10:28:14 +0000 (12:28 +0200)] 
http2: cleanup pushed newhandle on fail

When nghttp2_session_set_stream_user_data() fails, clean up the
new handle.

Reported-by: Joshua Rogers
Closes #18931

4 weeks agohttp2: check push header names by length first
Stefan Eissing [Wed, 8 Oct 2025 10:22:22 +0000 (12:22 +0200)] 
http2: check push header names by length first

Reported-by: Joshua Rogers
Closes #18930