tutor: Limit offset values, so that gcc is no longer afraid of buffer overflows in snprintf. (nw)

This commit is contained in:
Michael Zapf 2019-03-08 20:44:21 +01:00
parent e576d6201c
commit 873e217fdb

View File

@ -296,13 +296,13 @@ READ8_MEMBER( tutor_state::key_r )
char port[12];
uint8_t value;
snprintf(port, ARRAY_LENGTH(port), "LINE%d", offset >> 3);
snprintf(port, ARRAY_LENGTH(port), "LINE%d", (offset & 0x007e) >> 3);
value = ioport(port)->read();
/* hack for ports overlapping with joystick */
if (offset >= 32 && offset < 48)
{
snprintf(port, ARRAY_LENGTH(port), "LINE%d_alt", offset >> 3);
snprintf(port, ARRAY_LENGTH(port), "LINE%d_alt", (offset & 0x007e) >> 3);
value |= ioport(port)->read();
}