Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent crash when result of SendMessage is 0 #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shunf4
Copy link

@shunf4 shunf4 commented Apr 15, 2022

openssh 8.9 introduces feature "SSH agent restriction", which
means protocol extension (SSH_AGENTC_EXTENSION) will be used
(https://www.openssh.com/agent-restrict.html#limitations).

When connecting to older pageant with openssh 8.9 client,
the message with type SSH_AGENTC_EXTENSION can't be processed
by pageant, thus SendMessage returns 0, in which case
psd and usersid is likely to be freed twice in the code,
causing crash.

This commit fixes this.

openssh 8.9 introduces feature "SSH agent restriction", which
means protocol extension (SSH_AGENTC_EXTENSION) will be used
(https://www.openssh.com/agent-restrict.html#limitations).

When connecting to older pageant with openssh 8.9 client,
the message with type SSH_AGENTC_EXTENSION can't be processed
by pageant, thus SendMessage returns 0, in which case
`psd` and `usersid` is likely to be freed twice in the code,
causing crash.

This commit fixes this.
Copy link
Owner

@cuviper cuviper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that was a clear oversight. 😬

While we're here (or perhaps another PR), do you want to increase AGENT_MAX_MSGLEN? Putty has been using 256kB for a while now:
https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=98528db25a9df211141b8711a3756ee2b6ea26e9

@shunf4
Copy link
Author

shunf4 commented Apr 28, 2022

While we're here (or perhaps another PR), do you want to increase AGENT_MAX_MSGLEN? Putty has been using 256kB for a while now: https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=98528db25a9df211141b8711a3756ee2b6ea26e9

@cuviper I've created #64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants