summaryrefslogtreecommitdiff
path: root/ychat/Makefile
AgeCommit message (Collapse)Author
2026-06-30Fix runtime crashes: logd recursion, trim OOB, sock SO_REUSEADDR/accept, md5 ↵Paul Buetow
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).
2010-11-21moving into ychat subdirPaul Buetow