serve: reject valueless promisor-remote capability - #2199
Conversation
d460267 (Add 'promisor-remote' capability to protocol v2, 2025-02-18) added a receive callback which passes the capability value directly to mark_promisor_remotes_as_accepted(). However, a client can send the capability name without an '=' or value, in which case get_capability() supplies NULL and strbuf_split_str() dereferences it. Reject the missing argument before parsing it, and add a test covering this case. Signed-off-by: Elijah Newren <newren@gmail.com>
|
/submit |
|
Submitted as pull.2199.git.1786516783909.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
|
Elijah Newren wrote on the Git mailing list (how to reply to this email): On Tue, Aug 11, 2026 at 11:39 PM Elijah Newren via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Elijah Newren <newren@gmail.com>
>
> d460267613da (Add 'promisor-remote' capability to protocol v2,
> 2025-02-18) added a receive callback which passes the capability value
> directly to mark_promisor_remotes_as_accepted(). However, a client can
> send the capability name without an '=' or value, in which case
> get_capability() supplies NULL and strbuf_split_str() dereferences it.
Oops, I previously forgot to CC Christian as the author of
d460267613da. Doing that now. |
|
User |
|
This branch is now known as |
|
This patch series was integrated into seen via git@9737e16. |
|
There was a status update in the "New Topics" section about the branch A client requesting the promisor-remote capability without a value caused a null pointer dereference, which has been corrected by rejecting a request without an argument. Needs review. source: <pull.2199.git.1786516783909.gitgitgadget@gmail.com> |
|
Christian Couder wrote on the Git mailing list (how to reply to this email): On Wed, Aug 12, 2026 at 8:42 AM Elijah Newren via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Elijah Newren <newren@gmail.com>
>
> d460267613da (Add 'promisor-remote' capability to protocol v2,
> 2025-02-18) added a receive callback which passes the capability value
> directly to mark_promisor_remotes_as_accepted(). However, a client can
> send the capability name without an '=' or value, in which case
> get_capability() supplies NULL and strbuf_split_str() dereferences it.
Yeah, the original code you mention used strbuf_split_str(), but since
68a746e9a8 (promisor-remote: use string_list_split() in
mark_remotes_as_accepted(), 2025-09-08), string_list_split() is used
instead. Anyway string_list_split() also crashes when a NULL is passed
as its `const char *string` argument.
> Reject the missing argument before parsing it, and add a test covering
> this case.
Yeah, the fix and its test look right to me. Thanks. |
|
User |
|
There was a status update in the "Cooking" section about the branch A client requesting the promisor-remote capability without a value caused a null pointer dereference, which has been corrected by rejecting a request without an argument. Will merge to 'next'? cf. <CAP8UFD0+iXC3VxWmuuuB7La-pP6hdz58tr6vaEJSKpXJ_4ZH2w@mail.gmail.com> source: <pull.2199.git.1786516783909.gitgitgadget@gmail.com> |
cc: Elijah Newren newren@gmail.com
cc: Christian Couder christian.couder@gmail.com