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

Jinseok Kim always.starving0@gmail.com
Tue Mar 17 18:00:57 CET 2026


Hi,

Is replacing

  static char fname1[BUF_SIZE], fname2[BUF_SIZE], fname3[BUF_SIZE];

with

  static char fname1[PATH_MAX], fname2[PATH_MAX], fname3[PATH_MAX];

considered sufficient here?

The -Wformat-truncation warning still occurs:

  snprintf(fname2, sizeof(fname2), "%s.rename1", fname1);
  snprintf(fname3, sizeof(fname3), "%s.rename2", fname1);

Since fname1 can already be PATH_MAX bytes long, appending a suffix
like ".rename1" or ".rename2" may exceed PATH_MAX.

Is it acceptable to keep this warning as-is, or should this be handled
differently?

Thanks,
Jinseok.


More information about the ltp mailing list