• docs/v322_new.md src/sbbs3/userdat.c

    From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Tue Dec 1 01:07:24 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/3787d22a3cf2e18e850f4bf3
    Modified Files:
    docs/v322_new.md src/sbbs3/userdat.c
    Log Message:
    find_login_id(): range-check a user number before narrowing it to int

    With login by user number enabled, find_login_id() did
    usernum = (int)strtoul(...) and then range-checked usernum. Where
    unsigned long is 64 bits (LP64: 64-bit Linux, *BSD, macOS) a number
    above INT_MAX wrapped in the cast before the check, so "4294967297" was accepted as the login ID of user #1, "4294967298" of user #2, and so on.
    The user's password was still required. Where unsigned long is 32 bits (Windows, 32-bit builds), strtoul() overflows to ULONG_MAX, which the
    cast turned negative and the check refused.

    The parsed value is now compared with lastuser() (and checked for
    ERANGE) before the cast, and a lastuser() below 1 matches nothing.

    Tested with system.find_login_id() against a user base whose last user
    is 1457: 4294967297 and 4294967298 resolved to users 1 and 2 before and
    are refused now; 1, 2, 1457, 1458, 0, 1x, 2147483648 and
    18446744073709551617 give the same results as before.

    Fixes #1365

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

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