mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +03:00
tutor: Limit offset values, so that gcc is no longer afraid of buffer overflows in snprintf. (nw)
This commit is contained in:
parent
e576d6201c
commit
873e217fdb
@ -296,13 +296,13 @@ READ8_MEMBER( tutor_state::key_r )
|
|||||||
char port[12];
|
char port[12];
|
||||||
uint8_t value;
|
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();
|
value = ioport(port)->read();
|
||||||
|
|
||||||
/* hack for ports overlapping with joystick */
|
/* hack for ports overlapping with joystick */
|
||||||
if (offset >= 32 && offset < 48)
|
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();
|
value |= ioport(port)->read();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user