• src/sbbs3/js_cryptcert.cpp js_cryptcon.cpp js_socket.cpp ssl.c ssl.h

    From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Wed Dec 2 20:49:02 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/ec22e67e8a98cacf8a21ee76
    Modified Files:
    src/sbbs3/js_cryptcert.cpp js_cryptcon.cpp js_socket.cpp ssl.c ssl.h Log Message:
    Fetch cryptlib attribute strings in one call everywhere

    cryptGetAttributeString() takes no destination size, so querying an
    attribute's length and then fetching it into a buffer of that size
    overflows if the attribute grows in between (#1456). The JS CryptContext, CryptCert and Socket classes still used that pattern. Their handles
    normally belong to one script, so it was not known to be exploitable
    there, but it would become so as soon as a handle is shared between
    threads.

    Add fetch_crypt_attribute(), which fetches once into a buffer of
    cryptlib's maximum attribute size and returns the cryptlib status, and
    use it (or get_binary_crypt_attribute(), now built on it) at every such
    call site. Time attributes are fetched the same way and size-checked
    before being copied into a time_t.

    This also fixes CryptCert.get_attribute_time(), which never resumed the
    JS request it suspended when the fetch succeeded: the context's final
    garbage collection then waited forever, hanging jsexec at exit. And the CryptContext and CryptCert property getters no longer leak their buffer
    when the second fetch failed; a failed fetch now reads as undefined.

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

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