Commit Graph

15481 Commits

Author SHA1 Message Date
Stefan Eissing
d1d5855689
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
2025-10-09 14:44:28 +02:00
Stefan Eissing
9e2c582d6c
memdup0: handle edge case
When length is already SIZE_MAX, fail without allocating.

Reported-by: Joshua Rogers
Closes #18966
2025-10-09 14:43:56 +02:00
Stefan Eissing
83bed97ad8
rustls: pass the correct result to rustls_failf
Reported-by: Joshua Rogers
Closes #18961
2025-10-09 14:43:14 +02:00
Daniel Stenberg
b0db5f12b1
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
2025-10-09 10:50:56 +02:00
Daniel Stenberg
29d0a308b4
setopt: allow CURLOPT_DNS_CACHE_TIMEOUT set to -1
It is documented as valid. Regression from commit b059f7deaf shipped in
8.16.0

Reported-by: Andrei Kurushin
Fixes #18959
Closes #18960
2025-10-09 10:42:35 +02:00
Daniel Stenberg
1ce6dff01a
openssl: fix peer certificate leak in channel binding
Reported-by: Stanislav Fort
Bug: https://hackerone.com/reports/3373640
Closes #18917
2025-10-09 09:10:37 +02:00
Stefan Eissing
f609b57389
http2: ingress handling edge cases
Fix some edge cases around the `data_max_bytes` handling when
processing ingress.

Reported-by: Joshua Rogers
Closes #18933
2025-10-09 08:43:34 +02:00
Stefan Eissing
44a79d4f7a
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
2025-10-09 08:42:49 +02:00
Stefan Eissing
93e91e965e
http2: check push header names by length first
Reported-by: Joshua Rogers
Closes #18930
2025-10-09 08:41:20 +02:00
Joshua Rogers
dae19dd94a
libssh2/sftp: fix resume corruption by avoiding O_APPEND with rresume
Opening the remote file with O_APPEND while attempting to resume causes
all writes to be forced to EOF on servers/implementations where O_APPEND
semantics override a prior seek(). As a result, sftp_seek64() is ignored
and the resumed data is appended, duplicating/corrupting the file.

Fix by:
- Using O_WRONLY (without O_APPEND) when resume_from > 0.
- Skipping the seek entirely if remote_append mode is requested.

Closes #18952
2025-10-09 08:30:23 +02:00
Joshua Rogers
391e3fbeec
libssh/sftp: fix resume corruption by avoiding O_APPEND with rresume
Opening the remote file with O_APPEND while attempting to resume causes
all writes to be forced to EOF on servers/implementations where O_APPEND
semantics override a prior seek(). As a result, sftp_seek64() is ignored
and the resumed data is appended, duplicating/corrupting the file.

Fix by:
- Using O_WRONLY (without O_APPEND) when resume_from > 0.
- Skipping the seek entirely if remote_append mode is requested.

Closes #18952
2025-10-09 08:30:09 +02:00
Stefan Eissing
c0a279a8e9
socks: deny server basic-auth if not configured
When the server proposes BASIC authentication and curl does
not have that configured, fail right away.

Reported-by: Joshua Rogers
Closes #18937
2025-10-09 08:28:42 +02:00
Stefan Eissing
0b4a704500
vquic: sending non-gso packets fix for EAGAIN
The function returned OK on EAGAIN and not the correct code.

Reported-by: Joshua Rogers
Closes #18936
2025-10-09 08:27:23 +02:00
Stefan Eissing
cc7b12347b
quiche: handle tls fail correctly
quiche receive may report a TLS failure after a verified handshake. That
needs to lead to a transfer receive error.

Reported-by: Joshua Rogers
Closes #18934
2025-10-09 08:26:39 +02:00
Daniel Stenberg
008078fc38
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
2025-10-08 23:18:38 +02:00
Stefan Eissing
0f02744c41
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
2025-10-08 23:16:50 +02:00
Stefan Eissing
ca789e09b5
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
2025-10-08 23:15:07 +02:00
Joshua Rogers
38ab421f60
h3/ngtcp2: close just-opened QUIC stream when submit_request fails
Closes #18904
2025-10-07 23:59:06 +02:00
Joshua Rogers
4e77388a0b
h3/nghttp3: return NGHTTP3_ERR_CALLBACK_FAILURE from recv_header
Closes #18904
2025-10-07 23:59:00 +02:00
Joshua Rogers
4bfd7a9615
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
2025-10-07 23:56:25 +02:00
Stefan Eissing
88a1ab511c
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
2025-10-07 17:24:01 +02:00
Stefan Eissing
0d573969de
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
2025-10-07 17:23:24 +02:00
Daniel Stenberg
496802fdcf
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 53be8166b2
Closes #18912
2025-10-07 17:18:05 +02:00
Stefan Eissing
53be8166b2
multi: notify rename, remove the last stragglers
in the public API.

Follow-up to 357808f4ad

Closes #18910
2025-10-07 14:54:49 +02:00
Stefan Eissing
089afd78cb
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
2025-10-07 13:14:50 +02:00
Joshua Rogers
783df22e59
vquic/ngtcp2: compare idle timeout in ms to avoid overflow
Closes #18903
2025-10-07 12:06:32 +02:00
Joshua Rogers
0061b2bfaa
vquic: fix idle-timeout checks (ngtcp2 ms<-->ns), 64-bit log & honor 0=no-timeout (osslquic)
Closes #18903
2025-10-07 12:06:26 +02:00
Stefan Eissing
357808f4ad
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
2025-10-07 10:55:31 +02:00
Stefan Eissing
f4e83a0adc
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
2025-10-07 09:04:31 +02:00
Daniel Stenberg
33380fa214
telnet: ignore empty suboptions
To avoid printing from en empty buffer

Reported-by: Joshua Rogers
Closes #18899
2025-10-06 23:54:01 +02:00
Daniel Stenberg
3660e6da80
tftp: return error if it hits an illegal state
Reported-by: Joshua Rogers
Closes #18894
2025-10-06 23:52:57 +02:00
Daniel Stenberg
bc90f80556
tftp: default timeout per block is now 15 seconds
Down from the previous (rather ridiculous) 3600.

Reported-by: Joshua Rogers
Closes #18893
2025-10-06 23:51:43 +02:00
Daniel Stenberg
f1ed50a517
tftp: don't pin or check address if recvfrom returns error
Follow-up to c4f9977c66
Reported-by: Joshua Rogers
Closes #18892
2025-10-06 23:50:34 +02:00
Daniel Stenberg
1a3a5cb720
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
2025-10-06 23:49:31 +02:00
Daniel Stenberg
e214b14501
telnet: send failure logged but not returned
Return error correctly when sending fails.

Reported-by: Joshua Rogers
Closes #18887
2025-10-06 23:37:43 +02:00
Daniel Stenberg
6d9636abd1
telnet: return error if WSAEventSelect fails
Reported-by: Joshua Rogers
Closes #18886
2025-10-06 23:35:59 +02:00
Daniel Stenberg
6c7fc22f9d
pingpong: remove two old leftover debug infof() calls 2025-10-06 23:16:04 +02:00
Daniel Stenberg
3517053cf7
curl_osslq: error out properly if BIO_ADDR_rawmake() fails
Reported-by: Joshua Rogers
Closes #18878
2025-10-06 23:14:55 +02:00
Daniel Stenberg
22ae8ac874
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
2025-10-06 23:13:53 +02:00
Daniel Stenberg
5090cce01c
libssh2: fix return code for EAGAIN
In disconnect

Closes #18874
2025-10-06 23:12:53 +02:00
Viktor Szakats
6f0e212f6e
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
2025-10-06 22:33:38 +02:00
Viktor Szakats
b12da22db1
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 db98daab05 #18844
Follow-up to 4deea9396b #18814

Closes #18866
2025-10-06 20:57:59 +02:00
Viktor Szakats
ef1794e50e
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
2025-10-06 19:31:13 +02:00
Daniel Stenberg
92a2125684
telnet: make bad_option() consider NULL a bad option too
Follow-up to a72e1552f2
Closes #18873
2025-10-06 16:00:04 +02:00
Daniel Stenberg
2b0e7cb7c6
ftp: remove misleading comments
They indicated that sockets would not be closed but they are.

Reported-by: Joshua Rogers
Closes #18871
2025-10-06 15:58:14 +02:00
Daniel Stenberg
6ef4871f5d
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
2025-10-06 15:56:23 +02:00
Daniel Stenberg
172e190c79
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
2025-10-06 15:48:00 +02:00
Daniel Stenberg
9e3c35a88e
ftp: fix the 213 scanner memchr buffer limit argument
Reported-by: Joshua Rogers
Closes #18867
2025-10-06 14:49:02 +02:00
Stefan Eissing
2f3cf17e33
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
2025-10-06 14:48:01 +02:00
Daniel Stenberg
decd7e157c
cf-socket: always check Curl_cf_socket_peek() return code
Make it trigger a warning if not.

Reported-by: Joshua Rogers
Closes #18862
2025-10-06 14:45:53 +02:00