diff options
| author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2026-06-01 01:07:53 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-07-17 14:54:55 +0200 |
| commit | bce0e640623372520d9d90c42f33ddbfb576ce69 (patch) | |
| tree | 0745adb852401290f0ee7e8f2277718db53d0786 /drivers/accessibility | |
| parent | fe58bfdd013ed84bd308321fac8f54c8ec4b823c (diff) | |
| download | linux-next-bce0e640623372520d9d90c42f33ddbfb576ce69.tar.gz linux-next-bce0e640623372520d9d90c42f33ddbfb576ce69.zip | |
accessibility: speakup: Fix incorrect string length computation in report_char_chartab_status()
snprintf() returns the "number of characters which *would* be generated for
the given input", not the size *really* generated.
In order to avoid too large values for 'len' (and potential negative
values for "sizeof(buf) - (len - 1)") use scnprintf() instead of
snprintf().
Fixes: c6e3fd22cd53 ("Staging: add speakup to the staging directory")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/20260531230804.254962-5-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/kobjects.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/accessibility/speakup/kobjects.c b/drivers/accessibility/speakup/kobjects.c index 0dfdb6608e02..943ef71b1329 100644 --- a/drivers/accessibility/speakup/kobjects.c +++ b/drivers/accessibility/speakup/kobjects.c @@ -92,9 +92,9 @@ static void report_char_chartab_status(int reset, int received, int used, if (reset) { pr_info("%s reset to defaults\n", object_type[do_characters]); } else if (received) { - len = snprintf(buf, sizeof(buf), - " updated %d of %d %s\n", - used, received, object_type[do_characters]); + len = scnprintf(buf, sizeof(buf), + " updated %d of %d %s\n", + used, received, object_type[do_characters]); if (rejected) snprintf(buf + (len - 1), sizeof(buf) - (len - 1), " with %d reject%s\n", |
