diff options
author | Adam Borowski <kilobyte@angband.pl> | 2016-09-15 10:47:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-22 05:41:54 -0400 |
commit | 669e0a51b1b50052b1615683cde64e1c28ae895f (patch) | |
tree | 63c34a3da13db5cb27ae308aa462d8a1275f1464 /drivers/tty/vt | |
parent | d2ec3f77de8e67b7a3dab3ec827467e0fd797c86 (diff) |
vt: Fix a read-past-array in vc_t416_color().
This makes it show up on UBSAN:
perl -e 'for (0..15) {my @x=("0")x$_;push @x,qw(38 2 64 128 192 4);printf
"\e[%smAfter %d zeroes.\e[0m\n", join(";",@x[0..($_+5<15?$_+5:15)]), $_}'
Seems harmless: if you can programmatically read attributes of a vt
character (/dev/vcsa*), multiple probes can obtain parts of vt_mode then
lowest byte (5th on 64-bit big-endian) of a pointer.
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r-- | drivers/tty/vt/vt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 2705ca960e92..b51586fea4e8 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -1316,7 +1316,7 @@ static int vc_t416_color(struct vc_data *vc, int i, | |||
1316 | /* 256 colours -- ubiquitous */ | 1316 | /* 256 colours -- ubiquitous */ |
1317 | i++; | 1317 | i++; |
1318 | rgb_from_256(vc->vc_par[i], &c); | 1318 | rgb_from_256(vc->vc_par[i], &c); |
1319 | } else if (vc->vc_par[i] == 2 && i <= vc->vc_npar + 3) { | 1319 | } else if (vc->vc_par[i] == 2 && i + 3 <= vc->vc_npar) { |
1320 | /* 24 bit -- extremely rare */ | 1320 | /* 24 bit -- extremely rare */ |
1321 | c.r = vc->vc_par[i + 1]; | 1321 | c.r = vc->vc_par[i + 1]; |
1322 | c.g = vc->vc_par[i + 2]; | 1322 | c.g = vc->vc_par[i + 2]; |