Out-of-bound access in sysrq

From: Jiri Slaby
Date: Thu Mar 28 2013 - 06:34:13 EST


Guys,

how is this supposed to work?

#define SYSRQ_KEY_RESET_MAX 20 /* Should be plenty */
static unsigned short sysrq_reset_seq[SYSRQ_KEY_RESET_MAX];
...
unsigned short platform_sysrq_reset_seq[] __weak = { KEY_RESERVED };
...
static inline void sysrq_register_handler(void)
{
...
for (i = 0; i < ARRAY_SIZE(sysrq_reset_seq); i++) {
key = platform_sysrq_reset_seq[i];
if (key == KEY_RESERVED || key > KEY_MAX)
...




i runs from 0 to 19 incl., but platform_sysrq_reset_seq, if not
overriden, is of size 1, so?

thanks,
--
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/