check that driver names contain only [0-9a-z_] (nw)

This commit is contained in:
Vas Crabb 2016-09-10 10:42:52 +10:00
parent 6a2b41aa0b
commit b36662dbf2

View File

@ -1378,6 +1378,14 @@ void validity_checker::validate_driver()
if (is_clone && strlen(m_current_driver->name) > 16)
osd_printf_error("Clone driver name must be 16 characters or less\n");
// make sure the driver name doesn't contain invalid characters
for (const char *s = m_current_driver->name; *s != 0; s++)
if (((*s < '0') || (*s > '9')) && ((*s < 'a') || (*s > 'z')) && (*s != '_'))
{
osd_printf_error("Driver name contains invalid characters\n");
break;
}
// make sure the year is only digits, '?' or '+'
for (const char *s = m_current_driver->year; *s != 0; s++)
if (!isdigit((UINT8)*s) && *s != '?' && *s != '+')