浏览代码

GHS: Escape custom command comments

Fixes: #25171
William Sciaroni 2 年之前
父节点
当前提交
5a41d926dd
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      Source/cmGhsMultiTargetGenerator.cxx

+ 3 - 1
Source/cmGhsMultiTargetGenerator.cxx

@@ -415,7 +415,9 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
 #endif
   // Echo the custom command's comment text.
   if (cm::optional<std::string> comment = ccg.GetComment()) {
-    std::string echocmd = cmStrCat("echo ", *comment);
+    std::string escapedComment = this->LocalGenerator->EscapeForShell(
+      *comment, ccg.GetCC().GetEscapeAllowMakeVars());
+    std::string echocmd = cmStrCat("echo ", escapedComment);
     cmdLines.push_back(std::move(echocmd));
   }