• src/conio/cterm.c

    From Deucе@VERT to Git commit to main/sbbs/master on Fri Feb 25 10:54:50 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/37cdd991af1c54c30752bcc6
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Add a UINT64_MAX hack for VS 2022

    Not sure why this isn't defined from inttypes.h, but blah.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Oct 12 11:05:11 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/bb233b89b205ae98af9eacb6
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Continue fixing a coverity issue.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Thu Dec 22 23:35:08 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/1e9dcf477a5de94298f9bb74
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Clamp sixel repeat to 0x7fff per specification.

    This is the issue behind CVE-2022-24130 in xterm.
    Reported against SyncTERM by Autumn Lamonte (Thanks!)
    Discussion here: https://gitlab.com/klamonte/jexer/-/issues/105

    Closes SyncTERM bug 79.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Mon May 15 11:48:25 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/5c12fc2e5c7362a36fd68c23
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Fix memory leak and uninitialized acces in sixel graphics.

    Properly initialize sixel mask width/height.
    Free sx_mask->bits when finished.

    These were broken by the PPM feature commit 4975b41

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed May 31 13:27:51 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/cda7525d78b0948996c19561
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Fix off-by-one in delete lines

    Previously, delete lines would erase the line above the current one.
    This was visible in vim which makes extensive use of delete line
    to scroll.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Fri Jun 9 11:24:59 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/e5c75c3a8268961c2552edb9
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Add comments to hopefully shut up Coverity

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on ChromeOS)@VERT to Git commit to main/sbbs/master on Mon Jun 26 20:24:21 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/80379e9161895f4241bc30f3
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Fix warning: ‘end’ may be used uninitialized in this function

    Fix multiple warning: ignoring return value of ‘asprintf’
    declared with attribute ‘warn_unused_result’

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Jun 28 10:01:38 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/1181333075e9674aad79ff3e
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Fix for 80379e916

    The commit just the zero-length behaviour from uninitialized use
    with possible undefined behaviour to guaranteed undefined behaviour.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Sep 25 15:42:12 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/f209a29da73cb1da1bc7b4bf
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Bump revision.

    I need to document when I should do this better.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Nov 2 14:02:08 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/e8c6145d3d975d6157ec772d
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Implement line editing support.

    Changing "stuff" on a line will now propogate to the right
    appropriately.

    Next up is double-height characters... hopefully.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sun Nov 3 10:45:58 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/252e539cc03a4411e4b52897
    Modified Files:
    src/conio/cterm.c
    Log Message:
    "Handle" malloc() failures

    Just scream on stderr, and screw things up in the window.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sun Nov 3 22:42:40 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/76bf7cde63a9a19dfdb75034
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Make the default Prestel ID 0 bytes long.

    CCl4 sends an ENQ character in the login screen, and sends an ENQ
    which will auto-fill your username. Also, if you enter six zeros
    into the username, it will take you to the password field.

    With ten zeros, this means it's impossible to log in to CCl4.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Nov 27 05:28:48 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/9ab3cfcb1eb84576fe44740f
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Fix up the Prestel "Engineering Test Page" rendering

    This was due to two main bugs... the simple one was a type where
    the cutoff between separated and contiguous mosaics was incorrect,
    which caused the first four separated mosaics to not be displayed.

    The second was due to a number of bugs in the Hold Mosaic
    implementation.

    This fixes the first half of issue 172.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Nov 27 09:34:34 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/548763fda45f0d0db2bda11b
    Modified Files:
    src/conio/cterm.c
    Log Message:
    The final fixings for issue 172

    Use 0 for "no held mosaic" to avoid confusion around printable bytes.
    Store the state of the current cell *before* updating in fix_line()

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Dec 28 22:19:59 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/348f1a7e91c6fbab5b81c9e9
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Bump the CTerm revision.

    Commands are added.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Fri Jan 3 09:59:49 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/110f23bfdda7e6f7c96f8f1c
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Add some paranoia around size of macros.

    Initially set 1MB as the max macro size. I can't imagine wanting
    one bigger than this, but I can bump it up if needed.

    This likely fixes a vulerability where the BBS could at least crash
    SyncTERM, and at most take control of the users system. This
    likely isn't the only place that needs bounds checks like this.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Jan 4 21:51:35 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/c08f1613744351338e822c30
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Fix NULL dereference in strbuf error

    If strbuf is over 5MB, or the realloc() fails, clear strbuf and
    break before writing to strbuf.
    Found by scan-build

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Jan 4 21:51:35 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/0b61127f46337d568bba8560
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Set defaults for XTerm graphics query before checking

    Fixes potential read of uninitialized data.
    Found by scan-build

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Jan 4 21:51:35 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/72b1a6ed7da07e08e677c471
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Avoid read out of bounds in bad CSI m

    In the CSI 38 : 2 : Z? : R : G : B m variant, if there was no
    sub params (ie: CSI 38 : m), a read out of bounds would be
    triggered.
    Found by scan-build

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Jan 4 21:51:35 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/dc75bc36a58f294681a71856
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Handle malicious sequences with 2147483648 parameters.

    Previously, this could (but likely wouldn't) result in accesses
    outside of allocated memory, doing Very Bad Things.
    Found by scan-build

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Jan 4 22:39:55 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/5ff8b9fe668544911d33451b
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Another NULL dereference after overrunning the string buf.

    Found by scan-build

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Jan 11 00:01:13 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/9f6780d23478b6cb933d4949
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Get strncat() and strnlen() out of the hot path...

    Down to 4.7s now... 38× faster.
    Starting to get somewhere useful now.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Jan 11 00:25:01 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/d308ae450e792921290484a5
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Get strspn() out of the ANSI hot path.

    This was the only standout issue when profiling the ANSI parsing
    code, and is a trivial fix since we're pretty much only checking
    contiguous ranges of characters.

    Unfortunately, I didn't create a test for comparison here.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sat Jan 18 15:13:59 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/274d038bd34c8da952533932
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Fix race condition in starting/stopping playnote thread

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Sun Jan 19 08:44:55 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/51644d7992facd9e90a07b6a
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Indicate not running before posting sem

    Memory is free()ed after sem is posted, so this write goes into
    lalaland.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Mon Jan 20 16:21:27 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/c85d0cc939bffa1b1d30f1a1
    Modified Files:
    src/conio/cterm.c
    Log Message:
    retbuf paranoia

    Reported in unmonitor, which always passes NULL.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Jan 22 10:34:07 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/ac92a69b18331da6083a68e2
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Fix handling of C1 control characters

    At the same time, fix an old error in prestel_handle_escaped() that
    didn't pass the ctrl to prestel_apply_ctrl_after() properly, and
    always flush the print buffer before calling prestel_handle_escaped()

    We still shouldn't actually get C1 characters on a Prestel connection,
    but if we do, at least we're doing the right thing now.

    As for G1 characters, the default repetoire for these terminals per
    ITU-T REC. T0101 is the mosaic character set with smoothed moasics,
    something there's no evidence of a Prestel terminal ever supporting.
    In order to implement those properly, I would need special handling
    of "separated" in the renderer, and would need to fiddle with the
    font to include the contiguous smoothed mosaics (and exclide the
    separated ones). Since this would end up allowing wildly un-Pretel
    behaviour (ie: mosaics without a mosaic escape) I'm inclined to
    just treat them all as spaces and move on util/unless I do full
    support for all the Videotex standards. Nobody has asked me to
    open this can of worms, so I'm just going to leave it on the shelf.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Jan 22 11:55:15 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/1eb4ec043e73713ba2e9e4b2
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Ignore invalid ESC sequences in Prestel mode

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Jan 22 11:56:38 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/bf58917b5e6a0c11203e127d
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Clear cterm->sequence and cterm->escbuf when ignoring ESC

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Jan 22 12:00:47 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/7982c3cf4ad4cf07ae92d7ce
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Switch back to ignoring unhandled C0 bytes.

    This "feels" more like what the spec means.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Jan 22 12:07:34 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/1817c363cce0eb301f339cf0
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Update comments for closer reading of the spec.

    Section 2.3.1 is the C0 set, which "is not stored or displayed"
    Section 2.3.2 is the C1 set, so interpret "all control characters"
    in this context as meaning "all C1 characters".

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Thu Jan 23 12:26:13 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/4ab569ff44a8501fbfd653f4
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Some todone comments.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Feb 5 16:11:20 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/d6315867039caf232b681831
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Mode 7 terminals (ie: Commstar) do not support cursor control

    Specifically, \x11 is not cursor on, and \x14 is not cursor off.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Feb 5 20:03:09 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/ac68809c9d1f14f12b8fd6e1
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Split Prestel from Beeb emulation parsing, add VDU 7, 23, and 31

    Prestel and Beeb emulations are different enough that using a shared
    switch statement doesn't really make sense.

    This adds Mode 7 support for VDU commands 7 (beep), 23 (cursor only),
    and 31 (move to X/Y, 0-based).

    The rest of the unsupported commands don't seem overly useful in a
    BBS context (disable/enable output) or I don't want to deal with
    documenting and implementing ("Page mode").

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Feb 5 20:09:46 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/8379c1205104a28c7a10cee4
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Character 127 in Beeb mode is destructive backspace.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Feb 5 22:31:53 2025
    https://gitlab.synchro.net/main/sbbs/-/commit/848602f4b2461e547f28bd31
    Modified Files:
    src/conio/cterm.c
    Log Message:
    Fix handling of translated blast-through mosaics

    Since we're translating in ch[0], don't use buf[j] for mosaic or
    we'll lose the translation we just did.

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