• src/sbbs3/sbbsdefs.h

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Fri Sep 11 14:40:35 2026
    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>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)