X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fcurses_cons.c;h=9359ecc122a60100450a4c903938c1e4927c148a;hb=00460ac661afa22c2bb495eba4d4655d20a1bfdc;hp=90f695d29ad5cf1c732afd7de2d169c2053c0314;hpb=ec660ce1c5410ef08a7820f7ee064a30b416a523;p=palacios.releases.git diff --git a/palacios/src/devices/curses_cons.c b/palacios/src/devices/curses_cons.c index 90f695d..9359ecc 100644 --- a/palacios/src/devices/curses_cons.c +++ b/palacios/src/devices/curses_cons.c @@ -51,9 +51,14 @@ static int cursor_update(uint_t x, uint_t y, void *private_data) { struct vm_device *dev = (struct vm_device *) private_data; struct cons_state *state = (struct cons_state *) dev->private_data; - uint_t offset = (x * BYTES_PER_COL) + (y * BYTES_PER_ROW); + uint_t offset; uint_t last_x, last_y; + /* avoid out-of-range coordinates */ + if (x >= NUM_COLS) x = NUM_COLS - 1; + if (y >= NUM_ROWS) y = NUM_ROWS - 1; + offset = (x * BYTES_PER_COL) + (y * BYTES_PER_ROW); + /* unfortunately Palacios sometimes misses some writes, * but if they are accompanied by a cursor move we may be able to * detect this