On 05/09/2017 08:34 PM, Peter Hutterer wrote:
> list-local-devices.c:98:35: warning: ‘%s’ directive output may be truncated
> writing up to 255 bytes into a region of size 52 [-Wformat-truncation=]
>    snprintf(fname, 63, "/dev/input/%s", namelist[i]->d_name);
> 
> Can't happen here, but rather than disable a potentially useful warning just
> up the path to the max size.
> 
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
> ---
>  tools/list-local-devices.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/list-local-devices.c b/tools/list-local-devices.c
> index 6aa7600..2afb1a3 100644
> --- a/tools/list-local-devices.c
> +++ b/tools/list-local-devices.c
> @@ -93,9 +93,9 @@ int main(int argc, char **argv)
>       }
>  
>       while (i--) {
> -             char fname[64];
> +             char fname[PATH_MAX];
>  
> -             snprintf(fname, 63, "/dev/input/%s", namelist[i]->d_name);
> +             snprintf(fname, sizeof(fname), "/dev/input/%s", 
> namelist[i]->d_name);
>               dev = libwacom_new_from_path(db, fname, WFALLBACK_NONE, NULL);
>               if (!dev)
>                       continue;
> 

Looks good to me :)

   79d049a..63631a0  master -> master

-- 
Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to