summaryrefslogtreecommitdiffstats
path: root/libxrdp/xrdp_fastpath.c
diff options
context:
space:
mode:
authorspeidy <speidy@gmail.com>2014-02-10 06:26:55 +0200
committerspeidy <speidy@gmail.com>2014-02-10 06:26:55 +0200
commitf8d26973d09f2139f696f3ae1ebdde602ecf820c (patch)
treea484e48978914b4ca835101d74c36f2f30740abb /libxrdp/xrdp_fastpath.c
parentf525c0f8e76b1e2b8294c4a61c0da4d24e0406b4 (diff)
downloadxrdp-proprietary-f8d26973d09f2139f696f3ae1ebdde602ecf820c.tar.gz
xrdp-proprietary-f8d26973d09f2139f696f3ae1ebdde602ecf820c.zip
libxrdp: work on fastpath input, fix length issue in fastpath_recv
Diffstat (limited to 'libxrdp/xrdp_fastpath.c')
-rw-r--r--libxrdp/xrdp_fastpath.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libxrdp/xrdp_fastpath.c b/libxrdp/xrdp_fastpath.c
index 0d5c58c3..71e7f7c6 100644
--- a/libxrdp/xrdp_fastpath.c
+++ b/libxrdp/xrdp_fastpath.c
@@ -56,8 +56,9 @@ int APP_CC
xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
{
int fp_hdr;
- int len;
+ int len = 0;
int byte;
+ int hdr_len = 2;
DEBUG((" in xrdp_fastpath_recv"));
/* read the first fastpath byte
@@ -67,7 +68,7 @@ xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
self->numEvents = (fp_hdr & 0x3C) >> 2;
self->secFlags = (fp_hdr & 0xC0) >> 6;
- // receive fastpath packet length
+ // receive fastpath first packet length
if (xrdp_tcp_recv(self->tcp_layer, s, 1) != 0)
{
return 1;
@@ -79,6 +80,12 @@ xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
{
byte &= ~(0x80);
len = (byte << 8);
+ // receive fastpath second packet length
+ if (xrdp_tcp_recv(self->tcp_layer, s, 1) != 0)
+ {
+ return 1;
+ }
+ hdr_len++;
in_uint8(s, byte); /* length 2 */
len += byte;
}
@@ -87,8 +94,10 @@ xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
len = byte;
}
+ g_writeln("len= %d , numEvents= %d, secFlags= %d, bytesleft: %d", len, self->numEvents, self->secFlags, (s->p - s->data));
+
// receive the left bytes
- if (xrdp_tcp_recv(self->tcp_layer, s, len - (s->p - s->data)) != 0)
+ if (xrdp_tcp_recv(self->tcp_layer, s, len - hdr_len) != 0)
{
return 1;
}