From: Andrei Borzenkov Date: Sat, 9 Jan 2016 11:13:36 +0000 (+0300) Subject: grub-mklayout: check subscript bounds X-Git-Tag: 2.02-beta3~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=725548a2855e357cd5cd243dddef355295e63110;p=thirdparty%2Fgrub.git grub-mklayout: check subscript bounds Found by: Coverity scan. CID: 73686 --- diff --git a/util/grub-mklayout.c b/util/grub-mklayout.c index 1a4f1b4c8..d171c2700 100644 --- a/util/grub-mklayout.c +++ b/util/grub-mklayout.c @@ -384,6 +384,13 @@ write_keymaps (FILE *in, FILE *out, const char *out_filename) sscanf (line, "keycode %u = %60s %60s %60s %60s", &keycode_linux, 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. */ if (keycode_linux == 0x77 /* Pause */ /* Some obscure keys */