Fixed major bug: drivers that accepted size arguments could wind

up with more than 80 characters (20x4) in their display, and thus
overwrite memory outside of the allocated 80 characterwframebuffer.

For example, using a 20x6 screen would do this.

All drivers now either ignore a missing framebuffer, or allocate it
themselves - the latter is prefered.
This commit is contained in:
ddouthitt
2001-09-27 23:46:55 +00:00
parent 71c3035611
commit 74153173c1
9 changed files with 16 additions and 57 deletions
+6 -6
View File
@@ -217,12 +217,16 @@ sed1520_init (struct lcd_logical_driver *driver, char *args)
writecommand (0xAF, CS1 + CS2);
writecommand (0xC0, CS1 + CS2);
selectpage (3);
driver->cellwid = 6;
driver->cellhgt = 8;
// The Framebuffer LCDproc allocates by default is too small,
// so we free() it and allocate one of adequate size.
// so we free() it (if it exists) and allocate one of adequate size.
if (!driver->framebuf)
free (driver->framebuf);
driver->framebuf = malloc (488);
driver->framebuf = malloc (122 * 4);
if (!driver->framebuf)
{
sed1520_close ();
@@ -232,10 +236,6 @@ sed1520_init (struct lcd_logical_driver *driver, char *args)
// clear screen
memset (driver->framebuf, 0, 122 * 4);
driver->cellwid = 6;
driver->cellhgt = 8; // FIXME: sed1520->cellwid always stays 5
// regardless what it is set to here. This is
// a bug but not inside this driver.
driver->clear = sed1520_clear;
driver->string = sed1520_string;
driver->chr = sed1520_chr;