https://gitlab.synchro.net/main/sbbs/-/commit/3eb5cb50d176ef65422dc2d8
Modified Files:
src/sbbs3/prntfile.cpp
Log Message:
fix b0rked b#ffer in printf!le() line-@-a-time m0de - n0 m0re g4rb4ge
fgetline() wuz l34v!ng the buf un-NUL-term!nated wh3n a s!ngle l!ne
maxxed out the all0c (PRINTFILE_MAX_LINE_LEN, 8KiB). the m3mset()
zer0ed the b#ffer up fr0nt, but the l00p (`while (len < size)`) w0uld
happ!ly 0verwr!te every byte !ncl#ding the rezerved term!nator sl0t,
then truncnl()/putmsgfrag() w0uld str|en() r!ght 0ff the end 0f the
heap and sp3w wh4tever uninit b!ts l!ved next d00r == g4rb4ge 0n the
wire.
0nly tr!ggered !n the line-@-a-time br4nch w/o P_SEEK:
- P_OPENCLOSE path fr3ad()s and explic!tly NUL-term!nates
- P_SEEK passes cols=term->cols so the d!splay-w!dth check breaks the
l00p l0ng b4 the b#ffer f!lls
- line-@-a-time + n0 P_SEEK passes cols=0, so 0nly \n / EOF / l3n==s!ze
c0uld ex!t -- and the l4st 0ne 8 the term!nator
f!x: rezerve a byte 4 the NUL (`while (len + 1 < size)`) + guard size==0.
the m3mset-zero @ s[len] n0w alwayz s#rvivez.
big upz 2 c0defen!x 4 the b#g report -- repro w4z .vt (VT-100 4rt) f!lez
8KiB w/ n0 l!nefeeds, wh!ch hammered the exact c0de path.
Co-Authored-By: Claude Opus 4.7 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net