mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-20 15:43:16 +00:00
Low level use of 'vidattr()' can cause a NULL pointer to be
dereferenced. This is because 'SP' is only initialized via 'newterm()' (which is not required if you are going to interact with the 'terminfo' database without using 'ncurses'). PR: 6648 Submitted by: Max Euston <meuston@jmrodgers.com>
This commit is contained in:
parent
361854f773
commit
59fcc4ce0f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36083
@ -71,13 +71,14 @@ int fg, bg;
|
||||
}
|
||||
}
|
||||
|
||||
#define previous_attr SP->_current_attr
|
||||
|
||||
int vidputs(chtype newmode, int (*outc)(int))
|
||||
{
|
||||
chtype turn_off = (~newmode & previous_attr) & ~A_COLOR;
|
||||
chtype turn_on = (newmode & ~previous_attr) & ~A_COLOR;
|
||||
int pair, current_pair;
|
||||
static chtype previous_attr=0;
|
||||
chtype turn_off,turn_on;
|
||||
int pair, current_pair;
|
||||
|
||||
if (SP)
|
||||
previous_attr = SP->_current_attr;
|
||||
|
||||
T(("vidputs(%x) called %s", newmode, _traceattr(newmode)));
|
||||
T(("previous attribute was %s", _traceattr(previous_attr)));
|
||||
@ -85,6 +86,9 @@ int pair, current_pair;
|
||||
if (newmode == previous_attr)
|
||||
return OK;
|
||||
|
||||
turn_off = (~newmode & previous_attr) & ~A_COLOR;
|
||||
turn_on = (newmode & ~previous_attr) & ~A_COLOR;
|
||||
|
||||
pair = PAIR_NUMBER(newmode);
|
||||
current_pair = PAIR_NUMBER(previous_attr);
|
||||
|
||||
@ -184,6 +188,8 @@ int pair, current_pair;
|
||||
}
|
||||
|
||||
previous_attr = newmode;
|
||||
if (SP)
|
||||
SP->_current_attr = previous_attr;
|
||||
|
||||
T(("vidputs finished"));
|
||||
return OK;
|
||||
|
Loading…
Reference in New Issue
Block a user