summaryrefslogtreecommitdiff
path: root/drivers/accessibility
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2024-02-04 18:57:36 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-03 16:19:33 +0300
commit768625f84b2a6479d4e8f0bd599c53b1d5a35347 (patch)
tree3f057bc55d841703a4ddbf883e49ef0c8dfb3ed1 /drivers/accessibility
parentbf1eef7fc0f32d476e32166a2e06a45e172eb1c7 (diff)
downloadlinux-768625f84b2a6479d4e8f0bd599c53b1d5a35347.tar.xz
speakup: Fix 8bit characters from direct synth
[ Upstream commit b6c8dafc9d86eb77e502bb018ec4105e8d2fbf78 ] When userland echoes 8bit characters to /dev/synth with e.g. echo -e '\xe9' > /dev/synth synth_write would get characters beyond 0x7f, and thus negative when char is signed. When given to synth_buffer_add which takes a u16, this would sign-extend and produce a U+ffxy character rather than U+xy. Users thus get garbled text instead of accents in their output. Let's fix this by making sure that we read unsigned characters. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Fixes: 89fc2ae80bb1 ("speakup: extend synth buffer to 16bit unicode characters") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240204155736.2oh4ot7tiaa2wpbh@begin Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/accessibility')
-rw-r--r--drivers/accessibility/speakup/synth.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/accessibility/speakup/synth.c b/drivers/accessibility/speakup/synth.c
index eea2a2fa4f01..45f906103133 100644
--- a/drivers/accessibility/speakup/synth.c
+++ b/drivers/accessibility/speakup/synth.c
@@ -208,8 +208,10 @@ void spk_do_flush(void)
wake_up_process(speakup_task);
}
-void synth_write(const char *buf, size_t count)
+void synth_write(const char *_buf, size_t count)
{
+ const unsigned char *buf = (const unsigned char *) _buf;
+
while (count--)
synth_buffer_add(*buf++);
synth_start();