Re: [LTP] [PATCH 1/3] lib: Avoid loop_info.lo_name buffer overflow
Andrea Cervesato via ltp <[email protected]> Tue, 28 Jul 2026 14:19:24 +0000
| Newsgroups | it.linux.lists.ltp |
|---|---|
| Message-ID | <[email protected]> |
Hi Petr, > I suppose strncpy() is recommended as safer alternative to strcpy(), > right? Shouldn't we check for strlen(file) is not longer than > sizeof(loopinfo.lo_name) -1 while we are at it? we don't need to check for strlen(file) because strncpy() copy min(strlen(loopinfo.lo_name), strlen(file)) chars at max. -- Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp