Subj : SMB: smb_t.file is hard-coded to 128 bytes, shorter than MAX_PATH on e To : GitLab note in main/sbbs From : Rob Swindell Date : Fri Sep 11 2026 14:56:34 https://gitlab.synchro.net/main/sbbs/-/issues/1240#note_10324 Fixed in 3f86aa8a3f (soon-11-joke, 2026-09-11). The "Suggested fix" above was not quite right, and the correction is worth recording. `MAX_PATH + 1` is too large: the field is the stem, *without* extension, and smblib appends `.shd` / `.sdt` / `.sid` / `.sda` / `.sha` / `.sch` / `.ini` / `.hash` / `.lock` to it into `MAX_PATH + 1` buffers. Sizing the stem `MAX_PATH + 1` therefore does not remove the truncation, it just relocates it to the derived filenames. That is not a theoretical objection. Building the `MAX_PATH + 1` version first produced **17 new `-Wformat-overflow` reports in smbutil**, every one of them a four or five character extension appended to a now-`MAX_PATH` stem overflowing the buffer holding the result (`smbutil.c` lines 1218-1273, 1455-1492, 2039). Rebuilding with headroom reserved cleared all 17. The committed sizing reserves the longest extension, which is `.hash` (and `.lock`, the same length) at five characters counting the dot: ```c #define SMB_MAX_FILE_EXT_LEN 5 char file[MAX_PATH + 1 - SMB_MAX_FILE_EXT_LEN]; ``` That is 256 bytes on Windows, 1020 on macOS/BSD, 4092 on Linux, so a derived filename is at most MAX_PATH characters and fits a `MAX_PATH + 1` buffer by construction. ## One consumer also needed fixing `chksmb`'s `main()` built its `.shd` name in a `char str[128]`. No compiler diagnostic reaches that one in either direction: `SAFEPRINTF` is a bounded call, so `-Wformat-overflow` does not apply to it, and the `-Wformat-truncation` level enabled by `-Wall` does not fire either. It simply truncated. Found by auditing every buffer in the tree that receives `smb_t.file`; the other eight (`smbfile.c`, `getmail.c`, `smblib.c` x2, `smbutil.c`, `filedat.c` x2, `userdat.c`) were already `MAX_PATH + 1`. Verified with a clean serial build on Linux: the five server shared objects, the 23 utility binaries, and scfg/uedit/umonitor, with no warnings and no errors. -- *Authored by Claude (Claude Code), on behalf of @rswindell* --- SBBSecho 3.37-Linux * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705) .