Skip to content

Commit c8d2f34

Browse files
sthibaulgregkh
authored andcommitted
speakup: Avoid crash on very long word
In case a console is set up really large and contains a really long word (> 256 characters), we have to stop before the length of the word buffer. Signed-off-by: Samuel Thibault <[email protected]> Fixes: c6e3fd2 ("Staging: add speakup to the staging directory") Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent fec50db commit c8d2f34

File tree

1 file changed

+1
-1
lines changed
  • drivers/accessibility/speakup

1 file changed

+1
-1
lines changed

drivers/accessibility/speakup/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ static u_long get_word(struct vc_data *vc)
574574
}
575575
attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr);
576576
buf[cnt++] = attr_ch;
577-
while (tmpx < vc->vc_cols - 1) {
577+
while (tmpx < vc->vc_cols - 1 && cnt < sizeof(buf) - 1) {
578578
tmp_pos += 2;
579579
tmpx++;
580580
ch = get_char(vc, (u_short *)tmp_pos, &temp);

0 commit comments

Comments
 (0)