mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-04 17:33:12 +02:00
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.
This commit is contained in:
+2
-1
@@ -2595,7 +2595,8 @@ const char *StripControlCodesEx(const char *text, char *output, size_t outputlen
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
if ( col && ((isdigit(*text) && nc < 2) || (*text == ',' && nc < 3)))
|
||||
if ((col && isdigit(*text) && nc < 2) ||
|
||||
((col == 1) && (*text == ',') && isdigit(text[1]) && (nc > 0) && (nc < 3)))
|
||||
{
|
||||
nc++;
|
||||
if (*text == ',')
|
||||
|
||||
@@ -537,11 +537,15 @@ const char *_StripColors(const char *text)
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
if ((col && isdigit(*text) && nc < 2) || (col && *text == ',' && nc < 3))
|
||||
if ((col && isdigit(*text) && nc < 2) ||
|
||||
((col == 1) && (*text == ',') && isdigit(text[1]) && (nc > 0) && (nc < 3)))
|
||||
{
|
||||
nc++;
|
||||
if (*text == ',')
|
||||
{
|
||||
nc = 0;
|
||||
col++;
|
||||
}
|
||||
}
|
||||
/* Syntax for RGB is ^DHHHHHH where H is a hex digit.
|
||||
* If < 6 hex digits are specified, the code is displayed
|
||||
|
||||
Reference in New Issue
Block a user