• src/sbbs3/prntfile.cpp

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Thu Apr 30 14:14:50 2026
    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>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Tue May 5 15:55:25 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/8b4ddcae8c86c2b7255bcf69
    Modified Files:
    src/sbbs3/prntfile.cpp
    Log Message:
    printfile: guard fseeko restore against ftello failure (CID 645973)

    ftello() can return -1 on error; passing that to fseeko() with SEEK_SET
    is invalid. Skip the restore if the saved position was never captured.
    Same pattern in both 'n' (forward) and 'N' (backward) less-style search branches; Coverity flagged the latter at line 447.
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)