• exec/tests/file/ini_unesc

    From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Fri Nov 20 15:25:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/461eb40f7d57e2d17c12e85f
    Added Files:
    exec/tests/file/ini_unescape.js
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    xpdev: c_unescape_char_ptr() no longer steps past a string's end

    A string ending in a lone backslash made c_unescape_char_ptr() step past
    the terminating NUL, so c_unescape_str() and c_unescape_printable() went
    on reading (and, in place, writing) beyond the end of the string until
    the next NUL in memory. The backslash still yields NUL, so the string
    ends at it, as before. This has been the case since the unescape
    functions were created in 279370dc3f (room-3-your, 2004-08-04).

    Callers reach it with input from files: ini "key : value" string
    literals (ini_file.c unescapes the key, then the value, in the same line buffer), filter files read by findstr(), and @-code and message display (atcodes.cpp, putmsg.cpp). An ini line such as "key\:value" returned
    "alue" for "key": unescaping the key ran on into the value and shifted
    it over by one character.

    Test: exec/tests/file/ini_unescape.js (ini literals ending in a
    backslash, also inside quotes, at end of file and at the end of a key; findstr() on a file whose last line ends in a backslash). Without the
    fix the key case fails ("alue", expected "value"). An AddressSanitizer
    harness calling c_unescape_str() on a heap copy of "abc\" reported a heap-buffer-overflow read before the fix and none after it.

    Built with GCC only.

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
  • From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Fri Nov 20 15:46:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/764ae6b2cc5d36b3009e79da
    Modified Files:
    exec/tests/file/ini_unescape.js exec/tests/inet_domains/config/scratch.inc exec/tests/msgbase/notify/scratch.inc exec/tests/webmail/api_write.js client.js strings.js
    Log Message:
    tests: run in the CI test tree, and stop replacing write() and read()

    Three faults in tests that the CI jobs found, none in the code under
    test:

    - file/ini_unescape.js and webmail/api_write.js each declared a
    top-level function named write, and webmail/client.js and strings.js
    one named read. The runner executes every test in one process and
    such a declaration replaces the built-in function for every test
    that runs later: global/rtypes.js then called the test's write("")
    and failed. The helpers are renamed.
    - The scratch configurations of inet_domains/config and msgbase/notify
    copied node1/node.ini from the installation. The CI test tree has no
    node directories; an empty node.ini is now created there instead.
    - They also gave the scratch node directory as an absolute path, which
    the configuration cuts at 100 characters: too short for the temp
    directory of most CI runners. It is now relative to the scratch ctrl
    directory.

    The whole suite (jsexec -U -S -f exec/tests/test.js) now passes in a
    tree laid out as the CI one, with only ctrl and exec and a long path;
    under jsdoor, file/ini_unescape.js and global/rtypes.js pass there.

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