From 08c293b4050441d3169d9f4de0171241bd291832 Mon Sep 17 00:00:00 2001 From: Karl Mikaelsson Date: Fri, 2 Feb 2018 17:13:36 +0100 Subject: [PATCH] Fix Fast-Path PDU decryption regression This solves a problem where rdesktop would get really confused about the data read from the server and crash in random places just after connecting. --- secure.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/secure.c b/secure.c index b829a02..6443c6e 100644 --- a/secure.c +++ b/secure.c @@ -844,7 +844,7 @@ sec_process_mcs_data(STREAM s) STREAM sec_recv(RD_BOOL *is_fastpath) { - uint8 fastpath_hdr; + uint8 fastpath_hdr, fastpath_flags; uint16 sec_flags; uint16 channel; STREAM s; @@ -855,7 +855,9 @@ sec_recv(RD_BOOL *is_fastpath) { /* If fastpath packet is encrypted, read data signature and decrypt */ - if (fastpath_hdr & FASTPATH_OUTPUT_ENCRYPTED) + /* FIXME: extracting flags from hdr could be made less obscure */ + fastpath_flags = (fastpath_hdr & 0xC0) >> 6; + if (fastpath_flags & FASTPATH_OUTPUT_ENCRYPTED) { in_uint8s(s, 8); /* signature */ sec_decrypt(s->p, s->end - s->p);