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 41e2fdf4878a83fd5d5812212757c9ee0dca21a1..ee0c1b56d2b99a521eb29d533e8bcaf03a246f1a 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);