From eb78c43fabc82292e1140f986d4e1557d66cb186 Mon Sep 17 00:00:00 2001 From: denganliang Date: Fri, 22 May 2026 12:02:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=98=B2=E6=AD=A2GetDumpResult=E5=B0=86?= =?UTF-8?q?=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E8=B5=8B=E5=80=BC=E7=BB=99?= =?UTF-8?q?dumpResult?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当OHOS_GetMemLeakString malloc分配缓冲区但内容为空字符串时, 原代码只判断buf!=nullptr就直接赋值,增加*buf!='\0'判断, 避免空内容流入IPC传输链。 Co-Authored-By: Agent Signed-off-by: denganliang Change-Id: I31f55cc5e272e813ba3563942ee177ec0a6cdd3b --- frameworks/native/appkit/app/dump_runtime_helper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/native/appkit/app/dump_runtime_helper.cpp b/frameworks/native/appkit/app/dump_runtime_helper.cpp index de16e46933..45b90b836f 100644 --- a/frameworks/native/appkit/app/dump_runtime_helper.cpp +++ b/frameworks/native/appkit/app/dump_runtime_helper.cpp @@ -417,7 +417,7 @@ bool DumpRuntimeHelper::GetDumpResult(std::string &dumpResult) bool ret = func(TYPE_TXT, &buf, MEM_LEAK_MAX_SIZE); if (!ret) { TAG_LOGE(AAFwkTag::APPKIT, "TYPE_TXT Error"); - } else if (buf != nullptr) { + } else if (buf != nullptr && *buf != '\0') { dumpResult = buf; TAG_LOGI(AAFwkTag::APPKIT, "TYPE_TXT finish, result:%{public}s", dumpResult.c_str()); }