Date: Mon, 7 Jul 2025 20:16:51 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: bc6b526e2b71 - main - inotify: Use memcmp() to compare embedded file names Message-ID: <202507072016.567KGpNl006593@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bc6b526e2b71cf7e07806db5bc77926ed5c874f7 commit bc6b526e2b71cf7e07806db5bc77926ed5c874f7 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-07-07 19:30:35 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-07-07 20:16:31 +0000 inotify: Use memcmp() to compare embedded file names Otherwise gcc warns that strcmp() will read a byte from a zero-length array, though in practice we exclude that case with an explicit length check. Fixes: f1f230439fa4 ("vfs: Initial revision of inotify") --- sys/kern/vfs_inotify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c index 9562350c897f..41e73bb41a49 100644 --- a/sys/kern/vfs_inotify.c +++ b/sys/kern/vfs_inotify.c @@ -503,7 +503,7 @@ inotify_can_coalesce(struct inotify_softc *sc, struct inotify_event *evp) return (prev != NULL && prev->ev.mask == evp->mask && prev->ev.wd == evp->wd && prev->ev.cookie == evp->cookie && prev->ev.len == evp->len && - (evp->len == 0 || strcmp(prev->ev.name, evp->name) == 0)); + memcmp(prev->ev.name, evp->name, evp->len) == 0); } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202507072016.567KGpNl006593>