summaryrefslogtreecommitdiff
path: root/screen.h
blob: f5a15d4accbc430a930f694251fb3ca5167330d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef SCREEN_H
#define SCREEN_H

#include <curses.h>

enum colors {
	BLACK   = COLOR_BLACK,
	RED     = COLOR_RED,
	GREEN   = COLOR_GREEN,
	YELLOW  = COLOR_YELLOW,
	BLUE    = COLOR_BLUE,
	MAGENTA = COLOR_MAGENTA,
	CYAN    = COLOR_CYAN,
	WHITE   = COLOR_WHITE,
};

#define COLOR_MASK(fg, bg) ((fg) + (bg) * (COLOR_WHITE + 1))
#define COLOR(fg, bg) COLOR_PAIR(COLOR_MASK((fg), (bg)))
#define INIT_COLOR(fg, bg) init_pair(COLOR_MASK((fg), (bg)), (fg), (bg))
#define COLOR_ON(fg, bg) attron(COLOR(fg, bg))
#define COLOR_OFF(fg, bg) attroff(COLOR(fg, bg))

extern WINDOW *screen_init(bool israw);
extern void screen_end(void);

#endif /* SCREEN_H */
' class='oid'>ca221e796b274a6c909db003fcda215156aa4cc7 parent4d22c75d4c7b5c5f4bd31054f09103ee490878fd (diff)
fix a fencepost error in pipe_advance()
The logics in pipe_advance() used to release all buffers past the new position failed in cases when the number of buffers to release was equal to pipe->buffers. If that happened, none of them had been released, leaving pipe full. Worse, it was trivial to trigger and we end up with pipe full of uninitialized pages. IOW, it's an infoleak. Cc: stable@vger.kernel.org # v4.9 Reported-by: "Alan J. Wylie" <alan@wylie.me.uk> Tested-by: "Alan J. Wylie" <alan@wylie.me.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat