Commit graph

4 commits

Author SHA1 Message Date
9ca1e9d977 fix: data races, missing persistence, and input safety bugs
- Make client width/height _Atomic to fix data race between window-change
  callback thread and session thread
- Persist join/leave system messages via message_save()
- Fix ftell() error handling: check <= 0 instead of == 0
- Make room_add_message static to enforce lock-must-be-held contract
- Use local copy in execute_command to avoid mutating command_input
- Increase help_copy buffer from 4096 to 8192 for CJK text safety
- Add :q/:quit/:exit command for Vim-style disconnect
- Fix unit test Makefile to link common.c
2026-04-19 17:14:48 +08:00
d745a8e1fe fix: address security vulnerabilities and design flaws from comprehensive audit
Critical fixes:
- C-1: Use atomic_bool for client->connected and redraw_pending to prevent
  data races between callback and main threads
- C-2: Add reference counting for channel callbacks to prevent use-after-free
  when callbacks fire during client cleanup
- C-3/M-7: Use ssh_channel_read_timeout (5s) for UTF-8 continuation bytes
  to prevent thread blocking and stream desynchronization

High-severity fixes:
- H-1: Replace non-thread-safe setenv/tzset with timegm() in parse_rfc3339_utc
- H-2: Change room_get_message to return by value copy instead of interior pointer
- H-3: Log warning when rate-limit table evicts active IP entry
- H-4: Replace strcmp with constant-time comparison for access token validation
- H-5: Check signature_state in auth_pubkey to reject unsigned key offers

Medium/low fixes:
- M-1: Replace all atoi() with strtol() for proper error detection
- M-3: Move calloc outside rwlock in tui_render_screen to avoid blocking writers
- M-8: Fix off-by-one in rate limit threshold (> to >=)
- M-9: Trim partial UTF-8 sequences after snprintf truncation in message_format
- L-1: Validate continuation byte mask (0xC0==0x80) in utf8_decode
- D-3: Remove vestigial client_t.fd field
- L-3: Remove unreachable pthread_attr_destroy after infinite loop
2026-04-15 10:13:17 +08:00
e473b26e0d refactor: stabilize SSH runtime and add exec interface 2026-03-10 18:52:20 +08:00
63274b92ba Initial commit 2025-07-01 09:00:00 +08:00