1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-12 08:38:06 -05:00

Windows Pageant: fix off-by-one in -c option.

Apparently I never re-tested that option when I revamped Pageant's
command-line option parsing in commit dc183e1649b429a, because it's
now off by one in figuring out which argument to treat as the start of
the command to be run.

(The new code in that commit is the same shape as the old code but
with variables renamed, and that was the mistake, because in the old
code, the argument index i pointed to the -c option, whereas in the
new code, match_opt has already advanced amo.index to the next word.
So the two index variables _shouldn't_ be treated the same.)
This commit is contained in:
Simon Tatham 2022-05-04 19:57:47 +01:00
parent 03e71efcc5
commit af3520d245

View File

@ -1504,8 +1504,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
* If we see `-c', then the rest of the command line
* should be treated as a command to be spawned.
*/
if (amo.index < amo.argc-1)
command = argstart[amo.index + 1];
if (amo.index < amo.argc)
command = argstart[amo.index];
else
command = "";
break;