• src/xpdev/msg_queue.c msg_queue.h

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Wednesday, January 22, 2025 14:56:35
    https://gitlab.synchro.net/main/sbbs/-/commit/3d68720d2883d0b6d878568b
    Modified Files:
    src/xpdev/msg_queue.c msg_queue.h
    Log Message:
    API change: long->int

    No functional change
    --- SBBSecho 3.23-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Sunday, March 15, 2026 17:20:25
    https://gitlab.synchro.net/main/sbbs/-/commit/573398dc0201f069d0d90bdc
    Modified Files:
    src/xpdev/msg_queue.c msg_queue.h
    Log Message:
    Use protected integer for reference counter

    Fix concurrency issue reported by Claude via Deuce:
    msgQueueAttach() (line 77) does q->refs++ and msgQueueDetach() (line 92) does
    --q->refs on a plain int with no locking or atomics. These are non-atomic
    read-modify-write operations.
    If two threads call msgQueueDetach() concurrently with refs == 2:
    - Both read refs == 2, both write refs = 1, neither triggers the == 0 free →
    memory leak
    If two threads call msgQueueDetach() concurrently with refs == 1:
    - Both read refs == 1, both write refs = 0, both call msgQueueFree() →
    double-free
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)