Commit Graph

26 Commits

Author SHA1 Message Date
669e3a9e11 Second Batch: Update files using ChatGPT 4o 2024-05-31 15:52:13 +02:00
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
489c43f382 Return STREAM objects from data generating functions
Use a consistent style of returning a new STREAM object from functions
that output data, rather than requiring an existing structure to be
passed in. This generally makes the memory management more straight
forward and allows us to do more proper bounds checking of everything.

This also adds some new STREAM macros to make it easier to manage
them without poking around in the internal structure.
2019-05-06 14:33:11 +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
3e340f2f20 Add explicit STREAM allocation function
Avoids mistakes by making sure everyone allocates these the same
way.

The smart card code still has manual allocation because it has it's
own magical memory management.
2019-05-06 14:33:05 +02:00
Pierre Ossman
d8b0f3782a Give source code info in rdp_protocol_error()
Makes it easier to debug things by seeing exactly where the protocol
handling crashed.
2019-05-06 13:29:44 +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
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
e195953496 Refactor of writing utf16 strings to packets.
This remove the use of deprecated rdp_out_unistr() and
some minor cleanups.
2017-09-29 16:30:17 +02:00
Henrik Andersson
4cbfda90fd Move static stream helper functions to parse.c 2017-09-28 19:12:11 +02:00
Pierre Ossman
71f1cfb909 Fix pointer types for gss_wrap()/gss_unrap()
We were using the incorrect type for the context for these two calls.
No practical effects, but some noise from the compiler about the wrong
pointer type.
2017-07-10 15:12:26 +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
Henrik Andersson
03ec4e1fc8 Add additional 4 bytes to stream allocation.
Fixes memory corruptions where rdp_out_unistr() wants
string len plus 4 bytes allocated memory.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1826 423420c4-83ab-492f-b58f-81f9feb106b5
2014-08-29 10:57:24 +00:00
Henrik Andersson
e597ef4e90 Make sure to use rdp_out_unistr() when writing strings
to streams in CredSSP. (The other part of bug #383.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1801 423420c4-83ab-492f-b58f-81f9feb106b5
2014-05-20 07:49:52 +00:00
Henrik Andersson
77ec7d1128 Use rdp_out_unistr to fill in string in tspasswordcreds
packet. This fixes bug were login fails due to non-ASCII
characters in username or password.

Fixes bug #383.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1800 423420c4-83ab-492f-b58f-81f9feb106b5
2014-05-20 07:40:17 +00:00
Henrik Andersson
adbb6cf0fc Run indent-all script.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1721 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-20 12:57:00 +00:00
Henrik Andersson
6a6c3c8ab7 Make the cssp streambuffers dynamically grow instead of the static
size of 4096 which proved to be a problem.

Thanks to David Fries for patches.




git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1709 423420c4-83ab-492f-b58f-81f9feb106b5
2013-04-17 14:06:53 +00:00
Henrik Andersson
dfb3f21069 Fix indentation.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1708 423420c4-83ab-492f-b58f-81f9feb106b5
2013-04-12 08:06:01 +00:00
Henrik Andersson
d1e8fdc90a Initial support for CredSSP smartcard authentication.
- Add implementation of TSSmartCardCreds and TSCSPDataDetail for
  CredSSP protocol.
- Add handling of long opts for getopt()
- Added 4 new long opts for providing information to CredSSP which
  is required for smartcard credentials.
- Updated manual with information about the new arguments.

If smartcard authentication is request by commandline "-i" option,
and no CredSSP smartcard options is provided, rdesktop will
negotiate to use SSL and warn.




git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1705 423420c4-83ab-492f-b58f-81f9feb106b5
2013-03-25 13:01:38 +00:00
Henrik Andersson
d5e339e5d9 Add an check for mech set availability before using it,
this fixes a segfault if gssglue cant initialize when
/etc/gssapi_mech.conf is missing on system.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1685 423420c4-83ab-492f-b58f-81f9feb106b5
2012-11-29 11:38:29 +00:00
Henrik Andersson
b467d257c3 Cleanup of gssapi includes and fix for compile errors introduced.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1684 423420c4-83ab-492f-b58f-81f9feb106b5
2012-11-29 11:38:18 +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
Henrik Andersson
83c4ea4c16 Fixes the copyright of new code.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1678 423420c4-83ab-492f-b58f-81f9feb106b5
2012-11-16 22:17:36 +00:00
Henrik Andersson
51014c91df Initial implementation of kerberos server autentication with CredSSP,
disabled by default and is enabled using argument --enable-credssp
to configure script.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1676 423420c4-83ab-492f-b58f-81f9feb106b5
2012-11-15 11:21:01 +00:00