Re: [PATCH] mcstrans: increase context length limit in secolor.conf
Stephen Smalley <[email protected]> Fri, 24 Jul 2026 10:23:57 -0400
| Newsgroups | org.kernel.vger.selinux |
|---|---|
| Message-ID | <CAEjxPJ59FCf11jBW9ycDvO9RbH0FH+FuT+_GJMO9yhqCaqqY1w@mail.gmail.com> |
On Tue, Jul 21, 2026 at 1:53 PM Stephen Smalley <[email protected]> wrote: > > The 255 character limit on context strings in secolor.conf causes > mcstrans color translations to fail for legitimate contexts. > > Fixes: https://github.com/SELinuxProject/selinux/issues/333 > Signed-off-by: Stephen Smalley <[email protected]> Merged, maybe switch to %ms in the future. > --- > mcstrans/src/mcscolor.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mcstrans/src/mcscolor.c b/mcstrans/src/mcscolor.c > index fd8a248b..e4a0db74 100644 > --- a/mcstrans/src/mcscolor.c > +++ b/mcstrans/src/mcscolor.c > @@ -225,7 +225,7 @@ static int add_mnemonic(const char *name, uint32_t color) > May modify the data pointed to by the buffer parameter */ > static int process_color(char *buffer, int line) > { > - char rule[10], pat[256], f[256], b[256]; > + char rule[10], pat[4096], f[256], b[256]; > uint32_t i, fg, bg; > int ret; > > @@ -234,7 +234,7 @@ static int process_color(char *buffer, int line) > if (buffer[0] == '#' || buffer[0] == '\0') > return 0; > > - ret = sscanf(buffer, "%8s %255s = %255s %255s", rule, pat, f, b); > + ret = sscanf(buffer, "%8s %4095s = %255s %255s", rule, pat, f, b); > if (ret == 4) { > if (find_mnemonic(f, &fg) == 0 && find_mnemonic(b, &bg) == 0) > for (i = 0; i < N_COLOR; i++) > -- > 2.55.0 >