Skip to content

Commit

Permalink
libfreerdp-core: server fix for compressed, fragmented, PDUs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsorg71 committed Apr 22, 2012
1 parent 5c99404 commit 8aaa182
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libfreerdp-core/fastpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM
uint8* bm;
uint8* ptr_to_crypt;
uint8* ptr_sig;
uint8* holdp;
int fragment;
int sec_bytes;
int try_comp;
Expand All @@ -631,19 +632,20 @@ boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM
result = true;
rdp = fastpath->rdp;
sec_bytes = fastpath_get_sec_bytes(rdp);
maxLength = FASTPATH_MAX_PACKET_SIZE - 6 - sec_bytes;
totalLength = stream_get_length(s) - 6 - sec_bytes;
maxLength = FASTPATH_MAX_PACKET_SIZE - (6 + sec_bytes);
totalLength = stream_get_length(s) - (6 + sec_bytes);
stream_set_pos(s, 0);
update = stream_new(0);
try_comp = rdp->settings->compression;
comp_flags = 0;
comp_update = stream_new(0);

for (fragment = 0; totalLength > 0; fragment++)
{
stream_get_mark(s, holdp);
ls = s;
dlen = MIN(maxLength, totalLength);
cflags = 0;
comp_flags = 0;
header_bytes = 6 + sec_bytes;
pdu_data_bytes = dlen;
if (try_comp)
Expand Down Expand Up @@ -719,7 +721,7 @@ boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM
}

/* Reserve 6 + sec_bytes bytes for the next fragment header, if any. */
stream_seek(s, dlen - header_bytes);
stream_set_mark(s, holdp + dlen);
}

stream_detach(update);
Expand Down

0 comments on commit 8aaa182

Please sign in to comment.