Merge topic 'ghs-escape-custom-command-comments' into release-3.27

5a41d926dd GHS: Escape custom command comments

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8714
This commit is contained in:
Brad King
2023-08-16 13:46:35 +00:00
committed by Kitware Robot
+3 -1
View File
@@ -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));
}