diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-30 09:22:20 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-30 09:22:20 +0300 |
| commit | 1c36abeb27b0b0fed7eb07f008bcf9dcaaefb7bb (patch) | |
| tree | 6f2f9e29ea26e775f3c74840ab63255d7ab0d8b8 /yhttpd | |
| parent | 85dcf059333ce65930085fa6a0600aab871d6f44 (diff) | |
Fix runtime crashes: logd recursion, trim OOB, sock SO_REUSEADDR/accept, md5 session
Multiple latent bugs made the chat crash on real use (login POST segfaulted):
- logd::flush: when a log file can't be opened, log the error to stderr and
exit(1). Previously it called wrap::system_message, which routes back through
LOGD->log_simple_line->flush on the same failing logd -> infinite recursion
-> stack overflow (SIGSEGV). Bitten in k8s where an emptyDir on /app/log
hides the image's /app/log/rooms, so the room log open failed on login.
- tool::trim: rewrite the right-trim; the original did s_str[s_str.size()]
(out-of-bounds under _GLIBCXX_ASSERTIONS / UB) and erased at i_pos=size.
- sock::_make_server_socket: move SO_REUSEADDR setsockopt BEFORE bind so a
quick container restart rebinds port 2000 (was EADDRINUSE -> fallback to
2001, which the k8s Service doesn't target -> 502).
- sock::process_request: init accept() addrlen and bail on any accept error
(not just EAGAIN/EINTR) so we never proceed with fd=-1 (EBADF).
- chat.session.md5hash=false at runtime: the md5 session-id path does
s_hash.substr(s_ret.find(s_salt)+salt.len()+3); the default salt has chars
not in chat.session.validchars so find() returns npos and the substr/append
corrupts the heap and segfaults on login. Overridden via -o in the image CMD.
- docker-entrypoint.sh: mkdir -p /app/log/rooms at startup (volume mount hides
the image's copy).
Diffstat (limited to 'yhttpd')
0 files changed, 0 insertions, 0 deletions
