JakeChampion / JakeChampion/trafficserver

[10.2][http] Unguarded server_txn->get_netvc()->lerrno null-deref on origin error paths

Open
#74 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

10.2 area:httpsm audit severity:medium
Dominant language
C++
Stars
0
Forks
0
Avg merge
8h 2m
Merged PRs (30d)
21

Description

Branch: 10.2.x (10.2.1, commit 31f1f2f3b) · Severity: medium
Location: src/proxy/http/HttpSM.cc:6454, :6328, :4163

What's wrong

In handle_server_setup_error (VC_EVENT_ERROR), handle_post_failure, and tunnel_handler_post_server (VC_EVENT_ERROR), the code dereferences server_txn->get_netvc()->lerrno with no null check. ProxyTransaction::get_netvc() returns (_proxy_ssn) ? _proxy_ssn->get_netvc() : nullptr and can legitimately be null once the server side has been torn down on an error/abort path — exactly these paths — giving a null dereference and crash.

Fix

Fetch the netvc into a local and fall back to a sentinel errno when it is null:

NetVConnection *nvc = server_txn->get_netvc();
t_state.set_connect_fail(nvc ? nvc->lerrno : ECONNABORTED);

PR attached.

Testing

Compiles cleanly on 10.2.x (libhttp.a builds). clang-format clean.


From an automated multi-lens audit of the 10.2.x branch. Full report on branch claude/codebase-audit-review-9nw7vz (CODEBASE_AUDIT_10.2.md).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/proxy/http/HttpSM.cc at handle_server_setup_error, handle_post_failure, and tunnel_handler_post_server, using the stated line locations. Verify the three origin-error paths handle a missing server netvc without dereferencing it, then build libhttp.a on the 10.2.x branch and run clang-format checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.