grub-mklayout: check subscript bounds

Found by: Coverity scan.
CID: 73686
This commit is contained in:
Andrei Borzenkov 2016-01-09 14:13:36 +03:00
parent d5cc487d39
commit 725548a285

View file

@ -384,6 +384,13 @@ write_keymaps (FILE *in, FILE *out, const char *out_filename)
sscanf (line, "keycode %u = %60s %60s %60s %60s", &keycode_linux, sscanf (line, "keycode %u = %60s %60s %60s %60s", &keycode_linux,
normal, shift, normalalt, shiftalt); normal, shift, normalalt, shiftalt);
if (keycode_linux >= ARRAY_SIZE (linux_to_usb_map))
{
/* TRANSLATORS: scan code is keyboard key numeric identifier. */
fprintf (stderr, _("Unknown keyboard scan code 0x%02x\n"), keycode_linux);
continue;
}
/* Not used. */ /* Not used. */
if (keycode_linux == 0x77 /* Pause */ if (keycode_linux == 0x77 /* Pause */
/* Some obscure keys */ /* Some obscure keys */