[LTP] [PATCH v3] inotify: replace strcpy() with snprintf()

Andrea Cervesato andrea.cervesato@suse.com
Wed Mar 18 14:40:13 CET 2026


Hi,

> 
> The -Wformat-truncation warning still occurs:
> 
>   snprintf(fname2, sizeof(fname2), "%s.rename1", fname1);
>   snprintf(fname3, sizeof(fname3), "%s.rename2", fname1);

Indeed, compiler might complains in this case.

`snprintf()` can't overflow, but it can stop adding characters after `PATH_MAX`.
We need to verify the return value, but `PATH_MAX` can be still a valid return
value. I will cc @Cyril to ask for an opinion about it.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list