[PR #12484] [MERGED] Fix off-by-one bug in NormalizeCommandLine #29062

Open
opened 2026-01-31 09:32:32 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12484
Author: @lhecker
Created: 2/13/2022
Status: ✅ Merged
Merged: 2/14/2022
Merged by: @undefined

Base: main ← Head: dev/lhecker/12461-profile-matching


📝 Commits (1)

  • 662b7b8 Fix off-by-one bug in NormalizeCommandLine

📊 Changes

2 files changed (+10 additions, -8 deletions)

View changed files

📝 src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp (+8 -1)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp (+2 -7)

📄 Description

#12348 introduced an off-by-one bug. While the NormalizeCommandLine loop
should exit early when there aren't at least two arguments to be joined,
the final argument-append needs to happen even if just one argument exists.

This commit fixes the issue and introduces changes to additionally monitor
the early loop exit, as well as the call to ExpandEnvironmentStringsW.

PR Checklist

Validation Steps Performed

  • All TerminalSettingsTests tests pass ✅

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/12484 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 2/13/2022 **Status:** ✅ Merged **Merged:** 2/14/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/12461-profile-matching` --- ### 📝 Commits (1) - [`662b7b8`](https://github.com/microsoft/terminal/commit/662b7b8dec61c14f147f067d6becf8d3045a1224) Fix off-by-one bug in NormalizeCommandLine ### 📊 Changes **2 files changed** (+10 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp` (+8 -1) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp` (+2 -7) </details> ### 📄 Description #12348 introduced an off-by-one bug. While the `NormalizeCommandLine` loop should exit early when there aren't at least _two_ arguments to be joined, the final argument-append needs to happen even if just _one_ argument exists. This commit fixes the issue and introduces changes to additionally monitor the early loop exit, as well as the call to `ExpandEnvironmentStringsW`. ## PR Checklist * [x] Closes #12461 * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * All `TerminalSettingsTests` tests pass ✅ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:32:32 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29062