summaryrefslogtreecommitdiff
path: root/drivers/accessibility
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2024-03-23 19:48:43 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-27 18:11:40 +0300
commit8defb1d22ba0395b81feb963b96e252b097ba76f (patch)
treec91504b382ea0844bdafa0645af6d1d857a8c8f0 /drivers/accessibility
parent2a19c2a5caf084f4f985f5867c50effdd8201bdd (diff)
downloadlinux-8defb1d22ba0395b81feb963b96e252b097ba76f.tar.xz
speakup: Avoid crash on very long word
commit c8d2f34ea96ea3bce6ba2535f867f0d4ee3b22e1 upstream. 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 <samuel.thibault@ens-lyon.org> Fixes: c6e3fd22cd538 ("Staging: add speakup to the staging directory") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240323164843.1426997-1-samuel.thibault@ens-lyon.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/accessibility')
-rw-r--r--drivers/accessibility/speakup/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/accessibility/speakup/main.c b/drivers/accessibility/speakup/main.c
index 1fbc9b921c4f..736c2eb8c0f3 100644
--- a/drivers/accessibility/speakup/main.c
+++ b/drivers/accessibility/speakup/main.c
@@ -574,7 +574,7 @@ static u_long get_word(struct vc_data *vc)
}
attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr);
buf[cnt++] = attr_ch;
- while (tmpx < vc->vc_cols - 1) {
+ while (tmpx < vc->vc_cols - 1 && cnt < sizeof(buf) - 1) {
tmp_pos += 2;
tmpx++;
ch = get_char(vc, (u_short *)tmp_pos, &temp);