Skip to content

urlapi: return NULL from curl_url_dup() when given a NULL handle - #23051

Closed
filtede98 wants to merge 1 commit into
curl:masterfrom
filtede98:fix-url-dup-null-check
Closed

filtede98 wants to merge 1 commit into
curl:masterfrom
filtede98:fix-url-dup-null-check

Conversation

@filtede98

Copy link
Copy Markdown
Contributor

Passing a NULL handle to curl_url_dup() caused a NULL pointer dereference crash inside the DUP() macro when evaluating (in)->scheme.

Return NULL immediately if !in is passed, matching curl_easy_duphandle() and preventing crashes when duplicating uninitialized or failed handles.

Also verify this in test1560 and update curl_url_dup(3).

Previously, passing a NULL pointer to curl_url_dup() caused a NULL
pointer dereference crash on in->scheme inside the DUP() macro.

Return NULL immediately when !in, matching curl_easy_duphandle() and
preventing unexpected crashes when duplicating uninitialized or failed
handles.

Also verify this behavior in test 1560 and update documentation.
@testclutch

Copy link
Copy Markdown

Analysis of PR #23051 at fc806f09:

Test ../../tests/http/test_40_socks.py::TestSocks::test_40_03_dl_serial[h2-socks5] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them).

Generated by Testclutch

@bagder bagder closed this in 466c06c Sep 23, 2026
@bagder

bagder commented Sep 23, 2026

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants