https://gitlab.synchro.net/main/sbbs/-/commit/5ada5ab247cf590c48934f6f
Modified Files:
src/doors/termgfx/audio_mgr.c audio_mgr.h
Log Message:
termgfx_audio: reject over-long SFX cache names instead of
truncating
termgfx_audio_sfx_store() and _play_named() key a per-session
table on a caller-supplied leaf name (a content hash, e.g.
"s_<fnv1a8>"). The table stores leaves in a fixed 16-byte field
copied via strncpy(), silently truncating longer leaves. When
_play_named() later searches for the full leaf with strcmp(), it
never matches the truncated stored copy -- the sample never
plays.
Add length checks to both functions' early-return guards so an
over-long leaf is rejected (stores nothing, plays nothing) rather
than half-stored under a name that can never be found again. Also
replace strncpy() + manual NUL with snprintf() for clarity, and
document the 16-byte constraint on the header declarations (the
leaf must be shorter than NAMEDLEN, which is 16 bytes).
Current callers use "s_<8-hex>" (10 chars), so they're unaffected.
A future wider hash or longer name prefix would have hit this
silently without the length check; it now fails cleanly.
Test: all three doors (syncdoom/syncduke/syncmoo1) still build,
and syncmoo1's unit tests (test_map, test_audio) both pass.
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net