Skip to content

Commit f2d87e0

Browse files
benhillisBen HillisCopilot
authored
Fix unvalidated TerminalProfileSize during distribution import (#41495)
* Fix unvalidated TerminalProfileSize when importing a distribution _ProcessImportResultMessage constructed the terminal profile string_view using the message-supplied TerminalProfileSize without validating it against the received buffer length. Use the bounds-checked two-argument span::subspan() overload (matching the existing ShortcutIconSize handling a few lines above) so an inconsistent size value throws instead of producing a string_view that runs past the end of the buffer. Co-authored-by: Copilot <[email protected]> Copilot-Session: 35281c30-3d08-4f05-8c84-2ce4711023d5 * format source --------- Co-authored-by: Ben Hillis <[email protected]> Co-authored-by: Copilot <[email protected]> Copilot-Session: 35281c30-3d08-4f05-8c84-2ce4711023d5
1 parent acf3319 commit f2d87e0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎src/windows/service/exe/LxssUserSession.cpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3509,8 +3509,9 @@ void LxssUserSessionImpl::_ProcessImportResultMessage(
35093509
{
35103510
if (Message.TerminalProfileIndex != 0)
35113511
{
3512-
const auto terminalProfileSpan = Span.subspan(Message.TerminalProfileIndex);
3513-
const std::string_view terminalProfile(reinterpret_cast<const char*>(terminalProfileSpan.data()), Message.TerminalProfileSize);
3512+
const auto terminalProfileSpan = Span.subspan(Message.TerminalProfileIndex, Message.TerminalProfileSize);
3513+
const std::string_view terminalProfile(
3514+
reinterpret_cast<const char*>(terminalProfileSpan.data()), terminalProfileSpan.size());
35143515
_CreateTerminalProfile(terminalProfile, iconPath, Configuration, Registration);
35153516
}
35163517
else

0 commit comments

Comments
 (0)