From 82c2fad26c4134cc60eed9a3f05a9bbec70ab65b Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Mon, 26 Oct 2015 09:40:31 +0200 Subject: fbsplash: use virtual y size in mmap size calculations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The virtual y can be larger - and we can be even writing there since we are taking into account the y offset. Avoids possible crash. But use it only if set, seems it is not set if virtual area is not allocated (though, often fbcon allocates some scrollback area). Signed-off-by: Timo Teräs Signed-off-by: Denys Vlasenko --- miscutils/fbsplash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'miscutils/fbsplash.c') diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c index 77033c258..9557c41db 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c @@ -150,7 +150,7 @@ static void fb_open(const char *strfb_device) // map the device in memory G.addr = mmap(NULL, - G.scr_var.yres * G.scr_fix.line_length, + (G.scr_var.yres_virtual ?: G.scr_var.yres) * G.scr_fix.line_length, PROT_WRITE, MAP_SHARED, fbfd, 0); if (G.addr == MAP_FAILED) bb_perror_msg_and_die("mmap"); -- cgit v1.2.3