lkml.org 
[lkml]   [2023]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] accessibility: speakup: Fix incorrect string length computation in report_char_chartab_status()
On Mon, Sep 04, 2023 at 09:31:44PM +0200, Christophe JAILLET wrote:
> 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().
>

A bunch of kernel-janitors mail didn't reach my inbox... Like this
one. So weird.

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

The impact of this bug is a WARN() btw. snprintf() will refuse to
print negative bytes.

regards,
dan carpenter

\
 
 \ /
  Last update: 2023-09-06 11:10    [W:0.028 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site