From 59bed6c35477a6cc6cb435b7a015e2a67054a515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=AD=90=E6=81=92?= Date: Thu, 15 May 2025 17:19:54 +0800 Subject: [PATCH] bugfix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 魏子恒 --- .../js/src/mod_fs/class_watcher/watcher_entity.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 41e2fdf48..ee0c1b56d 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 @@ -195,15 +195,15 @@ void FileWatcher::ReadNotifyEvent(WatcherCallback callback) while (index < len) { event = reinterpret_cast(buf + index); if (sizeof(struct inotify_event) > (len - index)) { - HILOGE("out of bounds access, len: %lu, index: %d, inotify: %zu", - static_cast(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; } - if (static_cast(event->len) > - (static_cast(len - index - sizeof(struct inotify_event)))) { - HILOGE("out of bounds access, index: %d, inotify: %zu, event :%lu, len: %lu", - index, sizeof(struct inotify_event), - static_cast(event->len), static_cast(len)); + if (event->len > (static_cast(len - index - sizeof(struct inotify_event)))) { + HILOGE("out of bounds access, index: %{public}d, inotify: %{public}zu, " + "event :%{public}u, len: %{public}d", + index, sizeof(struct inotify_event), + event->len, len); break; } NotifyEvent(event, callback); -- Gitee