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

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

Original Pull Request: https://github.com/microsoft/terminal/pull/12484

State: closed
Merged: Yes


#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
**Original Pull Request:** https://github.com/microsoft/terminal/pull/12484 **State:** closed **Merged:** Yes --- #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 ✅
claunia added the pull-request label 2026-01-31 09:32:34 +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#29067