From cfd6a5a911f2d7c4ad5fe666bcda40d85fa3e59f Mon Sep 17 00:00:00 2001 From: tianp Date: Thu, 12 Jun 2025 19:38:04 +0800 Subject: [PATCH] =?UTF-8?q?copy=E6=8E=A5=E5=8F=A3=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F=E9=A3=8E=E9=99=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tianp Change-Id: I1dedcc11d7923cc99a7a49cba64b3821c83eaec8 --- interfaces/kits/cj/src/copy.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interfaces/kits/cj/src/copy.cpp b/interfaces/kits/cj/src/copy.cpp index 5f9647e63..7cded9586 100644 --- a/interfaces/kits/cj/src/copy.cpp +++ b/interfaces/kits/cj/src/copy.cpp @@ -494,6 +494,9 @@ void CopyImpl::ReadNotifyEvent(std::shared_ptr infos) auto callback = GetRegisteredListener(infos); while (((len = read(infos->notifyFd, &buf, sizeof(buf))) < 0) && (errno == EINTR)) {} while (infos->run && index < len) { + if ((index + sizeof(struct inotify_event)) > len) { + break; + } event = reinterpret_cast(buf + index); auto [needContinue, errCode, needSend] = HandleProgress(event, infos, callback); if (!needContinue) { -- Gitee