git: 3e8d10f256d5 - stable/14 - inotify: Use memcmp() to compare embedded file names
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 05 Aug 2026 15:16:40 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=3e8d10f256d5b2987370dbfefbca8c3f5f469113
commit 3e8d10f256d5b2987370dbfefbca8c3f5f469113
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-07-07 19:30:35 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-08-05 15:15:16 +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")
(cherry picked from commit bc6b526e2b71cf7e07806db5bc77926ed5c874f7)
---
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 3542989c6a48..8c9e7599b888 100644
--- a/sys/kern/vfs_inotify.c
+++ b/sys/kern/vfs_inotify.c
@@ -500,7 +500,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