Serial mouse, microtouch, and modem: Add some more sanity checks.

This commit is contained in:
OBattler
2024-09-20 13:36:01 +02:00
parent 6d5fd97cda
commit ea878410b0
3 changed files with 20 additions and 10 deletions

View File

@@ -322,6 +322,8 @@ void
mtouch_write_to_host(void *priv)
{
mouse_microtouch_t *dev = (mouse_microtouch_t *) priv;
if (dev->serial == NULL)
goto no_write_to_machine;
if ((dev->serial->type >= SERIAL_16550) && dev->serial->fifo_enabled) {
if (fifo_get_full(dev->serial->rcvr_fifo)) {
goto no_write_to_machine;

View File

@@ -142,7 +142,8 @@ sermouse_transmit_byte(mouse_t *dev, int do_next)
if (dev->buf_pos == 0)
dev->acc_time = 0.0;
serial_write_fifo(dev->serial, dev->buf[dev->buf_pos]);
if (dev->serial)
serial_write_fifo(dev->serial, dev->buf[dev->buf_pos]);
if (do_next) {
dev->buf_pos = (dev->buf_pos + 1) % dev->buf_len;