diff options
-rw-r--r-- | libxrdp/xrdp_mcs.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libxrdp/xrdp_mcs.c b/libxrdp/xrdp_mcs.c index 542d45c5..d8fb1804 100644 --- a/libxrdp/xrdp_mcs.c +++ b/libxrdp/xrdp_mcs.c @@ -664,6 +664,7 @@ int APP_CC xrdp_mcs_send(struct xrdp_mcs* self, struct stream* s, int chan) { int len; + char* lp; //static int max_len = 0; DEBUG((" in xrdp_mcs_send")); @@ -680,12 +681,27 @@ xrdp_mcs_send(struct xrdp_mcs* self, struct stream* s, int chan) //} //g_printf("mcs length %d max length is %d\r\n", len, max_len); //g_printf("mcs length %d\r\n", len); - len = len | 0x8000; out_uint8(s, MCS_SDIN << 2); out_uint16_be(s, self->userid); out_uint16_be(s, chan); out_uint8(s, 0x70); - out_uint16_be(s, len); + if (len >= 128) + { + len = len | 0x8000; + out_uint16_be(s, len); + } + else + { + out_uint8(s, len); + /* move everything up one byte */ + lp = s->p; + while (lp < s->end) + { + lp[0] = lp[1]; + lp++; + } + s->end--; + } if (xrdp_iso_send(self->iso_layer, s) != 0) { DEBUG((" out xrdp_mcs_send error")); |