https://gitlab.synchro.net/main/sbbs/-/commit/3f86aa8a3f2f7ac4049a34c2
Modified Files:
src/sbbs3/chksmb.c src/smblib/smbdefs.h
Log Message:
SMB: size smb_t.file from MAX_PATH, leaving room for the extension
smb_t.file was 128 bytes, shorter than MAX_PATH on every platform
Synchronet targets: 260 on Windows, 1024 on macOS/BSD, 4096 on Linux.
The fifty-odd sites that populate it all use a bounded printf, so a
longer path truncated with no last_error, no log line and no non-zero
return. smb_open() then worked on the truncated name: either an ENOENT
naming a path the sysop never configured, or, for two bases sharing
their first 127 characters, one silently reading and writing the
other's data.
The bound was already exceeded by the configured field widths alone. sub_t.data_dir and dir_t.data_dir are LEN_DIR + 1 (101) and their code
fields LEN_EXTCODE + 1 (33), so an area with a per-area data directory
reaches 132 characters.
The field is the stem, without extension, and smblib appends .shd,
.sdt, .sid, .sda, .sha, .sch, .ini, .hash and .lock to it in MAX_PATH +
1 buffers. Sizing it MAX_PATH + 1 would therefore only move the
truncation to those; GCC said as much, with seventeen -Wformat-overflow
reports in smbutil. Reserve the longest extension instead, ".hash" and
".lock" at five characters with the dot, so every derived name fits by construction.
chksmb built its .shd name in a 128-byte buffer. No diagnostic reaches
that one: SAFEPRINTF is a bounded call, so -Wformat-overflow does not
apply to it and the -Wformat-truncation level in -Wall does not fire.
Every other destination in the tree was already MAX_PATH + 1.
smb_t is a runtime structure and is never serialized, so this is not an
on-disk format change. It does change sizeof(smb_t): libsbbs.so /
sbbs.dll, the servers, smbutil, chksmb, fixsmb and sbbsecho have to be
rebuilt together. The Borland-built sbbsctrl.exe and UserEdit.exe do
not reference smblib and are unaffected.
GitLab #1240
Co-Authored-By: Claude Opus 5 (1M context) <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net