Fix segfault in vitastor-cli serve without TLS #85

Merged
vitalif merged 1 commits from epicstyt/vitastor:fix-serve-plain-http-segfault into master 2026-09-02 19:43:20 +03:00
Contributor

Description

Serving plain HTTP segfaults on the first accepted connection — zero bytes sent is enough. http_ctx (src/cmd/cli_serve.cpp:81) is assigned only in the TLS branch, so it stays NULL, and http_init() dereferences it unchecked (src/client/http_client.cpp:278). The added else builds a context with empty cert/key/CA: http_context_init skips all certificate loading and ssl stays false.

Contributor Name

Stepan Rabotkin

CLA

### Description Serving plain HTTP segfaults on the first accepted connection — zero bytes sent is enough. `http_ctx` (`src/cmd/cli_serve.cpp:81`) is assigned only in the TLS branch, so it stays NULL, and `http_init()` dereferences it unchecked (`src/client/http_client.cpp:278`). The added `else` builds a context with empty cert/key/CA: `http_context_init` skips all certificate loading and `ssl` stays false. ### Contributor Name Stepan Rabotkin ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
epicstyt added 1 commit 2026-09-02 15:15:43 +03:00
http_ctx was assigned only in the TLS branch, so on plain HTTP it stayed
NULL and http_init() segfaulted on the first accepted connection.

Signed-off-by: Stepan Rabotkin <epicstyt@gmail.com>
vitalif approved these changes 2026-09-02 19:43:10 +03:00
vitalif merged commit 26c6251888 into master 2026-09-02 19:43:20 +03:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#85
No description provided.