[PATCH evemu 1/2] Fix compiler warning about truncated output

Peter Hutterer peter.hutterer at who-t.net
Thu Jun 1 02:09:05 UTC 2017


It's a false positive because we only ever print /dev/input/eventXX but let's
shut it up anyway.

find_event_devices.c: In function ‘find_event_devices’:
find_event_devices.c:65:9: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 53 [-Wformat-truncation=]
     "%s/%s", DEV_INPUT_EVENT, namelist[i]->d_name);
         ^~
find_event_devices.c:64:3: note: ‘snprintf’ output between 12 and 267 bytes into a destination of size 64
   snprintf(fname, sizeof(fname),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     "%s/%s", DEV_INPUT_EVENT, namelist[i]->d_name);
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 tools/find_event_devices.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/find_event_devices.c b/tools/find_event_devices.c
index a73d08f..2a43d54 100644
--- a/tools/find_event_devices.c
+++ b/tools/find_event_devices.c
@@ -57,7 +57,7 @@ char* find_event_devices(void)
 
 	for (i = 0; i < ndev; i++)
 	{
-		char fname[64];
+		char fname[PATH_MAX];
 		int fd = -1;
 		char name[256] = "???";
 
-- 
2.13.0



More information about the Input-tools mailing list