https://gitlab.synchro.net/main/sbbs/-/commit/2cd36a8803eb6d40476b2e4e
Modified Files:
src/sbbs3/sbbsdefs.h
Log Message:
Cap LEN_SYSDIR at MAX_PATH
The rest of the tree builds paths in MAX_PATH + 1 buffers, so a system directory longer than MAX_PATH cannot be used: it truncates at the first
such buffer it reaches. On Windows, where MAX_PATH is 260, the 1023
LEN_SYSDIR resolved to was nearly four times what those buffers hold,
and the truncation was silent because MSVC has no -Wformat-overflow.
Take the smaller of MAX_PATH and INI_MAX_VALUE_LEN - 1, so a system
directory always fits a MAX_PATH + 1 buffer on every platform. Nothing
changes on Linux, where PATH_MAX is 4096. On Windows it also returns
roughly 1.9MB of the terminal server's node_scfg[]: ten such fields over MAX_NODES entries. Bounding by MAX_PATH rather than a literal means
that raising MAX_PATH for Windows long-path support would carry
LEN_SYSDIR with it.
A conditional expression rather than #if, because an #if naming MAX_PATH
from a translation unit that had not yet reached dirwrap.h would take
the MAX_PATH branch silently: an undefined identifier evaluates to 0
there. Include dirwrap.h directly rather than by way of smbdefs.h.
scfg_t changes size where the cap binds, so sbbsctrl.exe and
UserEdit.exe must be rebuilt alongside.
Co-Authored-By: Claude Opus 5 (1M context) <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net