From 98d2d32b868c38f6e5f4b2c89eebb78b397f7b64 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 10 May 2023 07:40:45 -0500 Subject: [PATCH] Don't let a window be created with the literal name "new" As on the tin. Blocking for 1.18. Tracked in #14957 --- src/cascadia/Remoting/Monarch.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cascadia/Remoting/Monarch.cpp b/src/cascadia/Remoting/Monarch.cpp index 3466e84d009..cf2edd98fa3 100644 --- a/src/cascadia/Remoting/Monarch.cpp +++ b/src/cascadia/Remoting/Monarch.cpp @@ -302,6 +302,10 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation { return 0; } + if (name == L"new") + { + return 0; + } uint64_t result = 0; @@ -1106,8 +1110,9 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation // In the case where window couldn't be found, then create a window // for that name / ID. // - // Don't let the window literally be named "-1", because that's silly - auto request = winrt::make_self(window == L"-1" ? L"" : window, + // Don't let the window literally be named "-1", because that's silly. Same with "new" + const bool nameIsReserved = window == L"-1" || window == L"new"; + auto request = winrt::make_self(nameIsReserved ? L"" : window, content, windowBounds); _RequestNewWindowHandlers(*this, *request);