Commit 87be424a authored by Christopher Brannon's avatar Christopher Brannon Committed by Greg Kroah-Hartman

Staging: speakup: fix an out-of-bounds error.

The cur_item variable from keyhelp.c is an index into a table of
messages.  The following condition should always hold:
MSG_FUNCNAMES_START + cur_item <= MSG_FUNCNAMES_END.
The check in keyhelp.c was wrong.  It allowed cur_item to be
incremented to an out-of-bounds value.
Signed-off-by: default avatarChristopher Brannon <chris@the-brannons.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1af47915
...@@ -161,7 +161,9 @@ int handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key) ...@@ -161,7 +161,9 @@ int handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key)
} }
cur_item = letter_offsets[ch-'a']; cur_item = letter_offsets[ch-'a'];
} else if (type == KT_CUR) { } else if (type == KT_CUR) {
if (ch == 0 && (cur_item + 1) <= MSG_FUNCNAMES_END) if (ch == 0
&& (MSG_FUNCNAMES_START + cur_item + 1) <=
MSG_FUNCNAMES_END)
cur_item++; cur_item++;
else if (ch == 3 && cur_item > 0) else if (ch == 3 && cur_item > 0)
cur_item--; cur_item--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment