Commit Graph

35235 Commits

Author SHA1 Message Date
Daniel Stenberg
dc4272318f
imap: remove redundant condition
'imap' always evaluates to true. Spotted by CodeSonar.

Closes #17318
2025-05-12 11:04:33 +02:00
Daniel Stenberg
da06f01ab9
rtsp: remove redundant condition
'rtsp' always evaluates to true. Spotted by CodeSonar.

Closes #17317
2025-05-12 11:03:44 +02:00
Daniel Stenberg
c5398fa393
netrc: avoid strdup NULL
Coverity found a code path where this might happen. Avoid it.

Closes #17319
2025-05-12 11:02:51 +02:00
Daniel Stenberg
5f6c714d24
http_chunks: narrow variable scope for 'trlen'
CodeSonar found a case where it would be assigned but never used and
narrowing the scope makes sense anyway.

Closes #17316
2025-05-12 11:02:00 +02:00
Daniel Stenberg
9455746af9
RELEASE-NOTES: synced 2025-05-12 07:47:34 +02:00
Daniel Stenberg
f862f863bf
mprintf: provide hex digits for escape.c to use
Since they need the exact same set, use the same set. The mprintf string
was longer than it had to be.

Closes #17311
2025-05-12 07:44:35 +02:00
Daniel Stenberg
1eb3928db6
mprintf: remove outdated comment about SIZEOF_SIZE_T
It was now plain wrong

Closes #17312
2025-05-12 07:43:54 +02:00
Daniel Stenberg
c37f4b6ac3
inet_ntop: rename curlx_inet_ntop to Curl_inet_ntop
It is not part of the curlx club.

Closes #17313
2025-05-12 07:42:59 +02:00
Jay Satiro
b794264408 curl_version_info.md: clarify ssl_version for MultiSSL
- Clarify that the ssl_version in MultiSSL builds contains all SSL
  backend names with the inactive backend names in parentheses.

Closes https://github.com/curl/curl/pull/17308
2025-05-11 12:23:36 -04:00
Daniel Stenberg
3b3d6a46ba
timeval.c: #include fix 2025-05-11 12:24:10 +02:00
Dan Fandrich
38865c8282 test1621: Improve stripcredentials tests
- add more unusual input cases
- add a valid non-http protocol
- fix tests so an input that should be stripped but isn't is a failure
- fix detection of when stripcredentials() would be available to test
- avoid using a NULL pointer

Closes #17304
2025-05-10 15:07:53 -07:00
Daniel Stenberg
674836399f
mime: reuse the base64 string from the base64 code
Avoids duplicating an identical string here.

Closes #17309
2025-05-10 23:01:14 +02:00
Daniel Stenberg
ff84228a53
base64: pass in the padding byte separately
The makes the string with base64 octets "pure" to be used elsewhere as
well.

Closes #17309
2025-05-10 23:01:07 +02:00
Daniel Stenberg
13032ff75c
curl: fix memory leak when -h is used in config file
Reported-by: antypanty on hackerone

Add test 748 to reproduce and verify fix

Closes #17306
2025-05-10 11:16:07 +02:00
Daniel Stenberg
cd7904f5a9
CURLMOPT_TIMERFUNCTION.md: correct the example
Fixes #17301
Reported-by: Dirk Feytons
Closes #17303
2025-05-09 17:04:40 +02:00
Viktor Szakats
1499319442
windows: fix to preserve error code in curlx_winapi_strerror()
Drop the interim macro `PRESERVE_WINDOWS_ERROR_CODE` and always preserve
error code for `_WIN32`. To make sure this is always done in
`curlx_winapi_strerror()`.

Follow-up to c74d3e10d2 #17299

Closes #17302
2025-05-09 15:56:07 +02:00
Daniel Stenberg
d4dd43b20d
curlx: move curlx_inet_pton
Used by test server code.

Closes #17300
2025-05-09 13:45:24 +02:00
Daniel Stenberg
c74d3e10d2
curlx: add curlx_winapi_ functions
Split them out from lib/strerror. Used by test code.

Closes #17299
2025-05-09 10:45:36 +02:00
Daniel Stenberg
9468503330
tests: stop using libcurl's strdup
It is not provided as a curlx function so should not be used outside of
libcurl.

I strongly suspect that no system we build the test suite on lack strdup
so this will not cause any harm.

The private version was added in b0936b8007 for Ultrix.

Closes #17297
2025-05-09 10:09:00 +02:00
Daniel Stenberg
a129859367
lib: drop curlx_getpid, use fake pid in SMB
It was not a function properly exposed in the curlx set. SMB cannot
possibly need to send a real pid, now sends a made up number.

The only real users of this function are test servers, so move the logic
over there.

Closes #17298
2025-05-09 10:01:30 +02:00
Daniel Stenberg
5fef848037
RELEASE-NOTES: synced 2025-05-08 22:33:01 +02:00
Daniel Stenberg
16db059a93
curlx: move version_win32.[ch] to curlx/
For curlx_verify_windows_version

Closes #17290
2025-05-08 17:09:32 +02:00
Viktor Szakats
5b454bae0c
cmake: test integration with old cmake (v3.11.4 2018-03-28)
Tests with old cmake are slow. (no Ninja, no unity, and running slower
than recent versions.)

It also revealed that 3.7.2 2017-01-13 is too old to consume curl via
`find_package()` due to:
```
CMake Error at bld-curl/_pkg/lib/cmake/CURL/CURLConfig.cmake:69 (add_library):
  add_library cannot create ALIAS target "CURL::libcurl" because target
  "CURL::libcurl_shared" is IMPORTED.
Call Stack (most recent call first):
  CMakeLists.txt:48 (find_package)

CMake Error at bld-curl/_pkg/lib/cmake/CURL/CURLConfig.cmake:69 (add_library):
  add_library cannot create ALIAS target "CURL::libcurl" because target
  "CURL::libcurl_shared" is IMPORTED.
Call Stack (most recent call first):
  CMakeLists.txt:49 (find_package)
```
The mitigation for this issue requires 3.11.

Also:
- rename a few existing envs to use the `TEST_` prefix.
- make the `find_package` test provider stage verbose.
- fix issue when consuming with cmake 3.7.2 (all platforms):
  ```
  CMake Error at /home/runner/cmake-3.7.2-Linux-x86_64/share/cmake-3.7/Modules/CMakeFindDependencyMacro.cmake:25 (message):
    Invalid arguments to find_dependency.  VERSION is empty
  Call Stack (most recent call first):
    bld-curl/_pkg/lib/cmake/CURL/CURLConfig.cmake:52 (find_dependency)
    CMakeLists.txt:48 (find_package)
  ```
  Ref: https://github.com/curl/curl/actions/runs/14906066962/job/41868621979?pr=17293#step:9:1199

Closes #17293
2025-05-08 15:11:24 +02:00
Daniel Stenberg
4190c73094
curlx: move nonblock.[ch] into curlx/
Closes #17288
2025-05-08 13:22:02 +02:00
Stefan Eissing
27bc798369
file: use easy handle meta for protocol struct
Closes #17292
2025-05-08 13:18:45 +02:00
Daniel Stenberg
1c6fc0cd2b
curlx: simplify the curlx_unicodefree macro
- explain its purpose in a comment

Closes #17287
2025-05-08 11:57:58 +02:00
Stefan Eissing
09fed29460
ssh: move easy handle/connection protocol structs to meta
Closes #17273
2025-05-08 11:56:50 +02:00
Daniel Stenberg
5b420f6329
src: drop strcase.[ch] from tool builds
They're not used there anymore.

Closes #17289
2025-05-08 11:39:58 +02:00
Daniel Stenberg
f0fc30e904
winbuild: curl_get_line is not used for tool builds
Drop it from the build. Also remove it from the tests/server makefile.

Follow-up to d8618f4d84

Closes #17286
2025-05-08 10:53:57 +02:00
Stefan Eissing
778f306551
rtmp: remove no longer used proto member
Add src/curlinfo to gitignore while we are here.
Add tests/server/dnsd to gitignore while we are here.

Closes #17252
2025-05-08 10:24:19 +02:00
Daniel Stenberg
c30c7d2170
src: include memdebug.h consistently with angle brackets <>
Not double quotes. Since the file is never local.

Closes #17284
2025-05-08 10:21:02 +02:00
Daniel Stenberg
2d528898f7
lib: move multibyte.[ch] to curlx/
This file provides functions in the curlx set.

Closes #17285
2025-05-08 10:19:19 +02:00
Stefan Eissing
f7057760eb
telnet: keep protocol struct at easy handle meta
Remove the member of data->req.p

Closes #17271
2025-05-08 09:30:56 +02:00
Daniel Stenberg
40ef77b6da
headers: enforce a max number of response header to accept
The limit is 5000 headers in a single transfer. To avoid problems caused
by mistakes or malice.

Add test 747 to verify

Reported-by: wolfsage on hackerone

Closes #17281
2025-05-08 08:17:56 +02:00
Daniel Stenberg
d689bd915e
src: rename curlx_safefree to tool_safefree
It is not part of the curlx function collection, just a macro that might
as well be a local version.

Closes #17270
2025-05-08 08:16:44 +02:00
Viktor Szakats
e522f47986
GHA/checksrc: check GHA rules with zizmor
The pedantic level is experimental. If it causes issues, we may just
disable it alongside the ignore comments.

Also:
- silence error:
  ```
   INFO audit: zizmor: completed label.yml
  error[dangerous-triggers]: use of fundamentally insecure workflow trigger
    --> label.yml:13:1
     |
  13 | 'on': [pull_request_target]
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ pull_request_target is almost always used insecurely
     |
     = note: audit confidence -> Medium
  ```
- fix pedantic warning:
  ```
   INFO audit: zizmor: completed label.yml
  warning[excessive-permissions]: overly broad permissions
    --> label.yml:1:1
  ...  |
  24 | |         with:
  25 | |           repo-token: '${{ secrets.GITHUB_TOKEN }}'
     | |____________________________________________________- default permissions used due to no permissions: block
     |
     = note: audit confidence -> Medium
  ```
- silence `template-injection` false positives like:
  ```
  - note: ${{ matrix.build.torture && 'test-torture' || 'test-ci' }} may expand into attacker-controllable code
  - note: ${{ contains(matrix.build.install_steps, 'pytest') && 'caddy httpd vsftpd' || '' }} may expand into attacker-controllable code
  ```
  It doesn't seem like these could be controlled by an attacker.
  Let me know if I'm missing something.

Closes #17278
2025-05-07 23:11:09 +02:00
Viktor Szakats
283ad5c432
GHA/windows: set persist-credentials: false where missing
Found by zizmor.

Closes #17277
2025-05-07 19:14:46 +02:00
Daniel Stenberg
613436dbbb
netrc: avoid NULL deref on weird input
A dynbuf that never gets populated might return a NULL, and Coverity
could find a way through like that.

Closes #17275
2025-05-07 17:15:39 +02:00
Stefan Eissing
412d3c3dc9
ldap: move easy handle protocol struct into meta hash
Removing the member of data->req.p

Closes #17269
2025-05-07 17:13:03 +02:00
Daniel Stenberg
3a2689712a
vtls: avoid NULL deref on bad PEM input
Spotted by Coverity

Closes #17274
2025-05-07 17:08:06 +02:00
Stefan Eissing
7b92844639
smtp: use easy handle/connectin meta for proto structs
Move `struct smtp_conn` and `struct STMP` into the meta data at easy
handle/connection. Remove it from the unions at connectdata and request.

Closes #17257
2025-05-07 16:01:05 +02:00
Daniel Stenberg
bc46ff2d2b
RELEASE-PROCEDURE: update the coming release dates 2025-05-07 14:39:18 +02:00
Daniel Stenberg
cf38e0067c
metahash: add asserts to help analyzers
Where NULL pointers are not acceptable input.

Closes #17268
2025-05-07 11:25:14 +02:00
Daniel Stenberg
255aac56f9
curlx: move into to curlx/
Move curlx_ functions into its own subdir.

The idea is to use the curlx_ prefix proper on these functions, and use
these same function names both in tool, lib and test suite source code.
Stop the previous special #define setup for curlx_ names.

The printf defines are now done for the library alone. Tests no longer
use the printf defines. The tool code sets its own defines. The printf
functions are not curlx, they are publicly available.

The strcase defines are not curlx_ functions and should not be used by
tool or server code.

dynbuf, warnless, base64, strparse, timeval, timediff are now proper
curlx functions.

When libcurl is built statically, the functions from the library can be
used as-is. The key is then that the functions must work as-is, without
having to be recompiled for use in tool/tests. This avoids symbol
collisions - when libcurl is built statically, we use those functions
directly when building the tool/tests. When libcurl is shared, we
build/link them separately for the tool/tests.

Assisted-by: Jay Satiro

Closes #17253
2025-05-07 11:01:15 +02:00
Stefan Eissing
17e13cba62
imap: use easy handle/connection meta for proto structs
Remove the imap protocol structs from connectdata->proto union
and data->req.p and use the easy handle/connection meta hash
for keeping them.

Closes #17261
2025-05-07 10:25:18 +02:00
Viktor Szakats
c6d0524265
cmake: set BUILDING_LIBCURL directly for unit test targets
To avoid adding this macro to the global `CURL_DEBUG_MACROS` variable,
which may be used for targets defined after unit tests, and where this
macro may not be necessary.

As of this commit unit tests are defined last, so extending the global
variable did not cause any issue.

Follow-up to 220eda34cd #17259

Closes #17264
2025-05-07 10:10:28 +02:00
Jay Satiro
e3802ab489 generate.bat: exclude curlinfo.c from legacy VS projects
- Do not include curlinfo.c as a ClCompile unit when compiling the curl
  tool.

Prior to this change generate.bat would add curlinfo.c to the source
files for the curl tool because it is located in the src directory. That
caused ambiguous behavior in legacy versions of Visual Studio which had
to guess between two main entry points (one in curlinfo and one in
tool_main, the latter being correct).

Closes https://github.com/curl/curl/pull/17263
2025-05-07 02:49:47 -04:00
Daniel Stenberg
220eda34cd
tests: separate tunit tests from unit tests more
- unit tests need no tool code as they are libcurl unit tests
- unit test 1621 is now tunit test 1621 instead, as it tests tool code
- build unit tests with BUILDING_LIBCURL as they pretent to be libcurl

Closes #17259
2025-05-06 17:25:22 +02:00
Stefan Eissing
2e49965126
rtsp: move easy handle/connection protoocol structs into meta data
Remove the connectdata proto and data->req.p member for rtsp and manage
the structs as meta data at easy handle/connection.

Closes #17254
2025-05-06 17:13:24 +02:00
Daniel Stenberg
f7c544d867
pop3: add null pointer check
Pointed out by Coverity. A precaution to catch internal errors.

Follow-up to 76d13c721b

Closes #17255
2025-05-06 17:11:25 +02:00