• src/sbbs3/js_msgbase.cpp mailsrvr.cpp src/smblib/smblib.c smblib.h src

    From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Sat Nov 14 13:33:55 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/5bc9f14f1408ea6564e5d591
    Modified Files:
    src/sbbs3/js_msgbase.cpp mailsrvr.cpp src/smblib/smblib.c smblib.h src/smblib/tests/smbidxtest.c
    Log Message:
    smblib: add smb_getmsghdr_for_idx() to refuse another message's header

    smb_getmsghdr() reads whatever header is at msg->idx.offset and checks
    only its ID and version. A caller that has just looked the message up in
    the index therefore got no error when the index record pointed at some
    other message's header (a damaged index, or a header relocated between
    the lookup and the read) and went on to use that header's content.
    On the mail base that means one user being sent, or deleting, another
    user's message, since the index decides whose mailbox a message is in.

    smb_getmsghdr_for_idx() reads the header the same way, then fails with
    the new SMB_ERR_HDR_NUMBER when the header's message number is not the
    index record's. smb_getmsghdr() is unchanged, for the callers that have
    only an offset (the base-scanning utilities, and the terminal server,
    which compares the number itself in sbbs_t::loadmsg()).

    Use it where an index lookup is followed directly by a header read:

    - mail server: the POP3 size scan at login, RSET, LIST, UIDL, RETR, TOP
    and DELE, and the send-mail thread
    - JS MsgBase: get_msg_header(), get_all_msg_headers(), put_msg_header(),
    remove_msg() and the body/tail readers

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

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