View Issue Details

IDProjectCategoryView StatusLast Update
0005908unrealircdpublic2021-06-08 05:33
Reportersemioriginal Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
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".

Issue History

Date Modified Username Field Change
2021-06-08 05:16 semioriginal New Issue
2021-06-08 05:33 semioriginal Note Added: 0021998