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

memory out of bounds read in rdp_read_share_control_header #6008

Closed
hac425xxx opened this issue Mar 31, 2020 · 0 comments · Fixed by #6019
Closed

memory out of bounds read in rdp_read_share_control_header #6008

hac425xxx opened this issue Mar 31, 2020 · 0 comments · Fixed by #6019

Comments

@hac425xxx
Copy link

hac425xxx commented Mar 31, 2020

version

https://github.com/FreeRDP/FreeRDP/blob/9ef1e81c559bb19d613b4da2d68908ea5d7f9259/libfreerdp/core/rdp.c#L1129

vuln code

if Stream_GetRemainingLength(s) = 5 and *length = 5, it could one byte overflow read in Stream_Read_UINT16(s, *channel_id);

BOOL rdp_read_share_control_header(wStream* s, UINT16* length, UINT16* type, UINT16* channel_id)
{
	if (Stream_GetRemainingLength(s) < 2)
		return FALSE;

	Stream_Read_UINT16(s, *length); /* totalLength */

	if (((size_t)*length - 2) > Stream_GetRemainingLength(s))
		return FALSE;

	Stream_Read_UINT16(s, *type); /* pduType */
	*type &= 0x0F;                /* type is in the 4 least significant bits */

	if (*length > 4)
		Stream_Read_UINT16(s, *channel_id);   // memory out of bounds read
	return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants