From f5835b2a24b451640745d72f589a82f706b1667c Mon Sep 17 00:00:00 2001 From: zyyj208 Date: Thu, 29 May 2025 07:39:26 +0000 Subject: [PATCH] =?UTF-8?q?CDE=E9=80=9A=E7=94=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zyyj208 --- interfaces/kits/js/src/mod_fs/class_watcher/watcher_entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/js/src/mod_fs/class_watcher/watcher_entity.cpp b/interfaces/kits/js/src/mod_fs/class_watcher/watcher_entity.cpp index ee0c1b56d..54d9851bf 100644 --- a/interfaces/kits/js/src/mod_fs/class_watcher/watcher_entity.cpp +++ b/interfaces/kits/js/src/mod_fs/class_watcher/watcher_entity.cpp @@ -194,7 +194,7 @@ void FileWatcher::ReadNotifyEvent(WatcherCallback callback) while (((len = read(notifyFd_, &buf, sizeof(buf))) < 0) && (errno == EINTR)) {}; while (index < len) { event = reinterpret_cast(buf + index); - if (sizeof(struct inotify_event) > (len - index)) { + if ((len - index) < sizeof(struct inotify_event)) { HILOGE("out of bounds access, len:%{public}d, index: %{public}d, inotify: %{public}zu", len, index, sizeof(struct inotify_event)); break; -- Gitee