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

httpclient.c:_RequestCallbackWrite does not handle partial sends. #439

Closed
dantraMSFT opened this issue Nov 13, 2017 · 1 comment
Closed

Comments

@dantraMSFT
Copy link
Contributor

dantraMSFT commented Nov 13, 2017

When connecting to office 365 with my domain credentials, the size of the client data exceeds the send buffer size and a partial send occurs. _RequestCallbackWrite calls _WriteClientHeader followed by _WriteClientData. When _RequestCallbackWrite is called a second time, it again calls _WriteClientHeader which returns an error since there is no header data to send.

A possible fix is to update _RequestCallbackWrite to detect the continuation of the client data and not call _WriteClientHeader. Added a (handler->SendHeader) condition appears to solve the problem but may not be the right solution.

This is blocking New-PSSession in PowerShell Core on non-windows systems. See PowerShell/PowerShell#5130

@dantraMSFT
Copy link
Contributor Author

NOTE: A possible fix is to make the call to _WriteClientHandler conditioned on handler->sendHeader:
if (handler->sendHeader)
{
// NOTE: for client data that requires multiple sends,
// handler->sendHeader will be cleared after the header is sent.
// Calling _WriteHeader a second time will result in an error.
switch (_WriteClientHeader(handler))
{
case PRT_CONTINUE: break;
case PRT_RETURN_TRUE: return MI_TRUE;
case PRT_RETURN_FALSE: return MI_FALSE;
}
}

yakman2020 pushed a commit that referenced this issue Nov 13, 2017
yakman2020 pushed a commit that referenced this issue Nov 13, 2017
Issues fixed:
  Issue #437: Buffer overrun in httpclient.c - _CreateHttpHeader
  Issue #438: Cannot enable libmi logging on psrp client using tag v1.4.0-6
  Issue #439: httpclient.c:_RequestCallbackWrite does not handle partial sends.
jeffaco pushed a commit that referenced this issue Nov 14, 2017
Issues fixed:

Issue #437: Buffer overrun in httpclient.c - _CreateHttpHeader
Issue #438: Cannot enable libmi logging on psrp client using v1.4.0-6
Issue #439: httpclient.c:_RequestCallbackWrite not handling partial sends.
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

No branches or pull requests

2 participants