Fix the color space parameter in RGB SGR, from Brad Town.

This commit is contained in:
nicm 2019-05-20 05:35:46 +00:00
parent 82ebd98c5f
commit 6e0c663a89

24
input.c
View File

@ -1938,23 +1938,25 @@ input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i)
} }
return; return;
} }
if (p[0] != 38 && p[0] != 48) if (n < 2 || (p[0] != 38 && p[0] != 48))
return; return;
if (p[1] == -1) switch (p[1]) {
i = 2;
else
i = 1;
switch (p[i]) {
case 2: case 2:
if (n < i + 4) if (n < 3)
break; break;
input_csi_dispatch_sgr_rgb_do(ictx, p[0], p[i + 1], p[i + 2], if (n == 5)
p[i + 3]); i = 2;
else
i = 3;
if (n < i + 3)
break;
input_csi_dispatch_sgr_rgb_do(ictx, p[0], p[i], p[i + 1],
p[i + 2]);
break; break;
case 5: case 5:
if (n < i + 2) if (n < 3)
break; break;
input_csi_dispatch_sgr_256_do(ictx, p[0], p[i + 1]); input_csi_dispatch_sgr_256_do(ictx, p[0], p[2]);
break; break;
} }
} }