Commit Graph

50 Commits

Author SHA1 Message Date
Pierre Ossman
25b8412333 Avoid poking around in STREAM internals
It's easy to make mistakes this way, and bypassed the normal bounds
checking. So make sure we always use macros or functions.
2019-05-06 14:33:38 +02:00
Pierre Ossman
c6d8b933c8 Avoid preallocated streams in tcp.c
We don't know when the caller might be done with a stream, so we
can end up with code overwriting things in a stream that is in use
elsewhere.

Solve the issue by returning a new stream each time and leave it
up to the callers to free it.
2019-05-06 14:33:05 +02:00
Pierre Ossman
75221eb3c5 Separate behaviour of out_uint8a and out_uint8p
Make them more match in_uint8a and in_uint8p in that one copies and
the other just gives you a pointer and it is up to the caller how
to fill it in. This can be useful when other APIs are used to
generate the data as it avoids a temporary buffer.
2019-05-06 14:33:05 +02:00
Pierre Ossman
6268b44f06 Add macro to check remaining length of STREAM
Avoids poking around in the internals, and also makes the code
easier to read.
2019-05-06 14:33:05 +02:00
Pierre Ossman
e099d79879 Remove dangerous s_check()
This macro checks if a pointer is valid _after_ we've already used
that pointer. So it will only trigger if we're already performed some
for of buffer overflow. As such, it provides little to no value and
can only server to encourage broken behaviour.

Let's remove it and replace it with proper bounds checking before
access instead.
2019-05-06 14:33:05 +02:00
Henrik Andersson
4dca546d04 Malicious RDP server security fixes
This commit includes fixes for a set of 21 vulnerabilities in
rdesktop when a malicious RDP server is used.

All vulnerabilities was identified and reported by Eyal Itkin.

 * Add rdp_protocol_error function that is used in several fixes
 * Refactor of process_bitmap_updates
 * Fix possible integer overflow in s_check_rem() on 32bit arch
 * Fix memory corruption in process_bitmap_data - CVE-2018-8794
 * Fix remote code execution in process_bitmap_data - CVE-2018-8795
 * Fix remote code execution in process_plane - CVE-2018-8797
 * Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175
 * Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175
 * Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176
 * Fix Denial of Service in sec_recv - CVE-2018-20176
 * Fix minor information leak in rdpdr_process - CVE-2018-8791
 * Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792
 * Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793
 * Fix Denial of Service in process_bitmap_data - CVE-2018-8796
 * Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798
 * Fix Denial of Service in process_secondary_order - CVE-2018-8799
 * Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800
 * Fix major information leak in ui_clip_handle_data - CVE-2018-20174
 * Fix memory corruption in rdp_in_unistr - CVE-2018-20177
 * Fix Denial of Service in process_demand_active - CVE-2018-20178
 * Fix remote code execution in lspci_process - CVE-2018-20179
 * Fix remote code execution in rdpsnddbg_process - CVE-2018-20180
 * Fix remote code execution in seamless_process - CVE-2018-20181
 * Fix remote code execution in seamless_process_line - CVE-2018-20182
2019-01-16 12:28:44 +01:00
Henrik Andersson
c16b74a974 Run indent-all.sh script on source 2018-10-29 15:53:57 +01:00
René Genz
9e99dd52d6 Fix minor spelling mistakes 2017-11-02 01:01:44 +01:00
Henrik Andersson
896a923f55 Markup unused parameters 2017-10-20 11:05:52 +02:00
Henrik Andersson
cb6460788c Remove unused variable 2017-09-26 13:58:56 +02:00
Henrik Andersson
87d8d123b8 Rework the logging system
This commit will add a logging system to solve the problem that
one actually need to recompile rdesktop from source to enable
different debug logging.

- Same logging api  for all kind of logging and messages to
   end user.

- Adding -v for verbose output when running rdesktop.

- All messages are logged into a subject and with a type, eg:

     logger(Keyboard, Notice, "Autos-electing %s based on locale.", locale);

- Debug logging is enabled trough a environment variable RDEKSTOP_DEBUG,
  which specifies subjects of interest, comma separated. There is a special
  subject named All which includes all subject for debug loggin. There is also
  a simple logic opeartor '!' = NOT which can be used in combination like:

    RDESKTOP_DEBUG=All,!Graphics,!Sound

  Which would give debug log output for All subject except Graphics and Sound.
2017-01-26 14:19:40 +01:00
remijouannet
b46639ad3c indent-all.sh 2016-05-24 18:02:22 +02:00
Peter Åstrand
1b50eb1e42 diag message spelling fix: persitent > persistent
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1829 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-11 06:36:25 +00:00
Henrik Andersson
46a3684c27 Document the new seamless protocol command PERSISTENT
and implement the usage of the new command in rdesktop.

If a seamless command is specified the persistent mode
of the session will be changed to non-persistent.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1822 423420c4-83ab-492f-b58f-81f9feb106b5
2014-07-03 10:42:04 +00:00
Henrik Andersson
2ceb56e0d4 Added seamless_reset_state() and use it whenever a
new window is created. This fixes issues with seamless
protocol parser between reconnects.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1820 423420c4-83ab-492f-b58f-81f9feb106b5
2014-07-02 08:25:07 +00:00
Peter Åstrand
bce8ca3baa Corrected DEBUG_SEAMLESS statement; use same style for both "got" and
"sending" messages. 



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1735 423420c4-83ab-492f-b58f-81f9feb106b5
2013-09-16 12:21:44 +00:00
Henrik Andersson
be93803129 Intitial implementation of seamless connection sharing:
- Implementation of ctrl functionality were slaves can call
  a method into existing master process, more information is
  found in doc/ctrl.txt

- Implementation of new seamless SPAWN functionality so which
  is used by the ctrl to spawn processes in a seamless rdp session
  out of process.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1689 423420c4-83ab-492f-b58f-81f9feb106b5
2013-01-21 12:28:14 +00:00
Henrik Andersson
51c17488a7 run of indent-all
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1679 423420c4-83ab-492f-b58f-81f9feb106b5
2012-11-22 07:57:26 +00:00
Peter Åstrand
5cb7910413 Indented with indent-all.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1670 423420c4-83ab-492f-b58f-81f9feb106b5
2012-10-23 11:38:27 +00:00
Henrik Andersson
66c9092910 Fixed indentation.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1608 423420c4-83ab-492f-b58f-81f9feb106b5
2011-01-03 13:14:50 +00:00
Peter Åstrand
281d7c9f06 Changed license to GPLv3
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1534 423420c4-83ab-492f-b58f-81f9feb106b5
2010-01-12 08:31:06 +00:00
Jay Sorg
88855ddcbf update the copyright year
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1474 423420c4-83ab-492f-b58f-81f9feb106b5
2008-07-11 03:51:23 +00:00
Peter Åstrand
8524a3fcf2 Applied patch:
[ 1715358 ] seamlessrdp window close


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1446 423420c4-83ab-492f-b58f-81f9feb106b5
2008-03-07 11:27:12 +00:00
Pierre Ossman
81a75745cb Implement support for icons in SeamlessRDP.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1412 423420c4-83ab-492f-b58f-81f9feb106b5
2007-06-18 12:00:34 +00:00
Pierre Ossman
d201361d53 Control seamless debug output via configure.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1409 423420c4-83ab-492f-b58f-81f9feb106b5
2007-06-13 14:53:32 +00:00
Jay Sorg
6091381a81 prefix BOOL with RD_
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1371 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-08 04:47:06 +00:00
Jay Sorg
797df4fa02 copyright year update
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1364 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-04 05:39:39 +00:00
Pierre Ossman
f8b9095263 Add a destroy group command to SeamlessRDP for when entire groups of windows
get killed off in one go.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1231 423420c4-83ab-492f-b58f-81f9feb106b5
2006-04-28 07:55:36 +00:00
Pierre Ossman
7656da0f6b Don't print server side debug messages unless WITH_DEBUG_SEAMLESS is defined.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1230 423420c4-83ab-492f-b58f-81f9feb106b5
2006-04-20 13:01:45 +00:00
Pierre Ossman
5b1de10ffc Support for the new HIDE/UNHIDE commands.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1192 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-22 16:20:55 +00:00
Pierre Ossman
8b98524485 Support for window groups and modal windows.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1176 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-21 14:42:25 +00:00
Peter Åstrand
b09bdd7fac Cleaned up SeamlessRDP functions: All utility functions are prefixed with sw_.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1169 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-20 15:43:15 +00:00
Pierre Ossman
62b1c67758 Basic infrastructure for receiving seamless ACK:s.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1165 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-20 12:36:14 +00:00
Pierre Ossman
56b4c2714a Increase length to include the newline character.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1163 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-20 12:00:09 +00:00
Pierre Ossman
9319c65dbb Add serial numbers to protocol.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1162 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-20 10:31:58 +00:00
Peter Åstrand
2e7aa4b8b4 Send back our local positions upon changes, but only after a small timeout.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1156 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-17 12:39:09 +00:00
Pierre Ossman
b899e2f50f Detect focus changes and send FOCUS to the server.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1153 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-17 09:56:20 +00:00
Pierre Ossman
8d65411c21 Support for seamless window restacking (ZCHANGE).
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1150 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-17 08:52:29 +00:00
Pierre Ossman
905e228417 Don't activate seamless mode until we have a working connection with the
remote server (i.e. when we get a HELLO).

Also change g_seamless_rdp to mean that -A was specified on the command line.
g_seamless_active now indicates if we're in seamless or "normal" mode.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1148 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-16 15:27:59 +00:00
Peter Åstrand
c90a9e7064 Use strtol for signed variables.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1124 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-15 11:34:55 +00:00
Peter Åstrand
4a7a75d402 Support for SeamlessRDP SYNCBEGIN/SYNCEND
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1122 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-15 08:41:48 +00:00
Peter Åstrand
94d8419910 Changed strtoll/strtol to strtoul.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1120 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-15 08:18:05 +00:00
Peter Åstrand
1644b0aecd Using strtoll for window ids, since strtol is signed, and we need to
use all bits of a long.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1119 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-15 06:55:29 +00:00
Peter Åstrand
5652570792 Always printing what we are sending, when DEBUG_SEAMLESS is enabled.
Use 0x%08lx instead of 0x%p.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1115 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-13 15:04:51 +00:00
Peter Åstrand
7b4304a21c Implemented seamless_send_state.
seamless_send is now a varargs function.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1109 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-10 15:19:52 +00:00
Peter Åstrand
26df0c0c94 Always call strtol with zero base, to be tolerant
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1103 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-10 13:34:41 +00:00
Peter Åstrand
95f39af2d3 Parsing the new CREATE command, with parent parameter.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1097 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-10 12:44:32 +00:00
Peter Åstrand
f756bec8c3 SETSTATE is not two ops: TITLE and STATE
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1093 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-10 10:40:50 +00:00
Peter Åstrand
63b6684562 Removed the version numbers from SeamlessRDP commands
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1089 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-10 09:01:51 +00:00
Peter Åstrand
b06a70bf51 Initial support for SeamlessRDP
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1088 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-10 08:50:43 +00:00