View Issue Details

IDProjectCategoryView StatusLast Update
0005908unrealircdpublic2023-03-18 14:02
Reportersemioriginal Assigned Tosyzop  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Fixed in Version6.0.7 
Summary0005908: +S channel mode strips too much
DescriptionThe +S channel mode strips illegal mIRC color sequences like "\003," or "\003,4", or "\0034," (they are illegal because color codes cannot be empty). Instead, only "\003", "\003", or "\0034" should be stripped, and the subsequent ",", ",4", or "," should be left in the message.

The code in question is here,
  https://github.com/unrealircd/unrealircd/blob/389a971f9606f0f3848a308f05e2038814b92610/src/modules/message.c#L592-L597

I believe that checking `nc > 0` in addition to `nc < 3` when encountering a comma is the right fix.
TagsNo tags attached.
3rd party modules

Activities

semioriginal

2021-06-08 05:33

reporter   ~0021998

Actually, that quick fix isn't good enough. Instead we'll nee something like

<code c>
        if ((col && isdigit(*text) && nc < 2) || (col == 1 && *text == ',' && isdigit(text[1]) && nc > 0 && nc < 3))
        {
            nc++;
            if (*text == ',')
            {
                nc = 0;
                col++;
            }
        }
</code>

which 1) checks that the ',' is followed by a digit, so it doesn't strip things like "\0034,", and 2) ensures that only one ',' is stripped, so it doesn't strip "\0034,5,6".

syzop

2023-03-18 14:01

administrator   ~0022777

Thanks for the report AND the patch! Applied now, after verification.. and ported to StripControlCodes() as well.

https://github.com/unrealircd/unrealircd/commit/3bccc63125b671b81cb5575349e01f5fbedb68e0

commit 3bccc63125b671b81cb5575349e01f5fbedb68e0 (HEAD -> unreal60_dev)
Author: Bram Matthys <[email protected]>
Date: Sat Mar 18 13:58:59 2023 +0100

    Fix +S stripping too much on incorrect color codes.
    Reported by semioriginal in https://bugs.unrealircd.org/view.php?id=5908
    with the patch also by semioriginal.

syzop

2023-03-18 14:02

administrator   ~0022778

And https://github.com/unrealircd/unrealircd/commit/eccf1088667e8bfb26b4852676ef66cc6d7f0244 :D

Issue History

Date Modified Username Field Change
2021-06-08 05:16 semioriginal New Issue
2021-06-08 05:33 semioriginal Note Added: 0021998
2023-03-18 14:01 syzop Assigned To => syzop
2023-03-18 14:01 syzop Status new => resolved
2023-03-18 14:01 syzop Resolution open => fixed
2023-03-18 14:01 syzop Fixed in Version => 6.0.7
2023-03-18 14:01 syzop Note Added: 0022777
2023-03-18 14:02 syzop Note Added: 0022778