• src/smblib/tests/smbupdatetest.csrc/sbbs3/writemsg.cpp src/smblib/smbf

    From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Tue Sep 29 19:31:12 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/01b9084b2a55c2486a512760
    Added Files:
    src/smblib/tests/smbupdatetest.c
    Modified Files:
    src/sbbs3/writemsg.cpp src/smblib/smbfile.c smblib.h src/smblib/tests/GNUmakefile
    Log Message:
    Edit only a message's body, and write its new text before freeing the old

    editmsg() freed a message's data blocks before allocating and writing
    the replacement, and wrote the header last. A failure in between (an
    allocation or write error, or a crash) left the header naming blocks that
    were already free, which the next message could be given and overwrite.

    It also put the body and tail (the signature, or an imported message's
    tear and origin lines) in the editor together and stored the result as a
    single body field, so after an edit the tail was no longer kept apart:
    the terminal server word-wrapped the signature with the body, and
    JavaScript readers found it in the body instead of the tail.

    editmsg() now edits only the body and keeps the tail as it is, and stores
    the text with the new smb_updatemsgtxt(), which writes the new data
    blocks, then the header and index, and only then frees the old blocks.
    A failure part-way leaks blocks (which chksmb reports and fixsmb
    reclaims) rather than leaving the message pointing at freed ones.

    smb_updatemsgtxt() is the former body of smb_updatefile(), from
    3a687044d3 (item-11-focal, 2026-09-21), which already replaced a file
    record's text this way; smb_updatefile() now calls it.

    Add smbupdatetest to src/smblib/tests.

    Fixes #1252
    Fixes #1270

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net