Commit Graph

98 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
Alexander Zakharov
85f99edd65 Update copyrights 2019-02-01 11:21:32 +03:00
Karl Mikaelsson
5351182410 Fix problems with transferring large files
The entire device redirection framework is documented to use 64-bit
offsets rather than 32-bit offsets. This should fix any problems
transfering large files with rdesktop.

Co-Authored-By: gpatel-fr <44170243+gpatel-fr@users.noreply.github.com>
2019-01-31 10:51:19 +01:00
Alexander Zakharov
758f7b5156 scard: Fix buffer overflow
Even though we can detect that the server buffer is too small to
receive the APDU result we don't prevent the actual copy of this result
to allocated buffer which results in overflow.
2019-01-23 16:12:21 +03:00
Alexander Zakharov
774a657975 Handle insufficient server side buffer for smartcard operations
We should pay attention to OutputBufferLength of DR_CONTROL_REQ
and send STATUS_BUFFER_TOO_SMALL if it's insufficient for returned
result.
2019-01-23 16:12:21 +03: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
Rostislav Kondratenko
2abd25ae2a Fix scard logon 2018-04-27 13:46:45 +03:00
René Genz
9e99dd52d6 Fix minor spelling mistakes 2017-11-02 01:01:44 +01:00
Henrik Andersson
0d707ae103 Fix sign-compare compiler warnings 2017-10-20 13:30:42 +02:00
Henrik Andersson
fd1673392e Fix unused-but-set-variable compiler warnings 2017-10-17 10:50:14 +02:00
Henrik Andersson
ff1a42f809 Refactor of writing utf16 strings to packets.
This remove the use of deprecated rdp_out_unistr() and
uses correct string length instead of assumition that all
utf16 symbols are represented by 2 bytes.
2017-09-29 16:30:17 +02:00
Henrik Andersson
1e68d67298 Run indent-all script 2017-03-03 09:31:26 +01:00
Henrik Andersson
d124477abb Merge pull request #96 from derfian/decipher-rdpdr-printer-device-announce
Clarify printer parts of rdpdr_send_client_device_list_announce
2017-01-30 10:05:02 +01:00
Karl Mikaelsson
7f6748d1c3 Clarify printer parts of rdpdr_send_client_device_list_announce
Add new flag constants and comments for all fields.
2017-01-30 09:35:29 +01:00
Henrik Andersson
7b9a09e173 Merge branch 'master' into logging 2017-01-27 10:56:16 +01: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
Karl Mikaelsson
90ea473750 Send longer drive names for redirected drives
Store the full drive name in a new disk-specific pdevice_data
struct. Bump Drive Redirection version to 02, and send the full name
as part of the Device Announcement message.
2017-01-25 13:27:01 +01:00
Karl Mikaelsson
b093dc198d Decipher the contents of the DR_CORE_CAPABILITY_RSP message
Add relevant constants from the specification and use them while
building the capabilities reply.
2017-01-20 16:05:59 +01:00
Henrik Andersson
761cc053e2 Fixes a bug with Windows Server 2012 r2 and smartcard
redirection were the RDPDR channel is shutdown by server.

The RDPDR channel is shutdown by server when responses from
abdonend iorequests are received on a reinitialized RDPDR
channel. This fix adds epochs for RDPDR channel and tags 
iorequest to specific epoch to handle abdonend iorequest.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1836 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-11 11:54:46 +00:00
Henrik Andersson
03c53c48bd Fix implementation of DR_CORE_CLIENT_NAME_REQ packet.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1834 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-11 08:58:40 +00:00
Henrik Andersson
ae54605c8d - Clarification of client and server announce
- Make sure to use server supplied ClientID if
  server VersionMinor is >= 12.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1833 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-11 08:54:31 +00:00
Henrik Andersson
388cec747d - Clarification of code.
- Make sure to send DR_CORE_CAPABILITY_RSP as response
  to DR_CORE_SERVER_ANNOUNCE_REQ.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1832 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-11 08:38:27 +00:00
Henrik Andersson
0858a6c9a7 Clarify implementation to match MS-RDPEFS spec.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1831 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-11 08:19:23 +00:00
Henrik Andersson
ace6c10a5b Remove dead code.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1830 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-11 07:50:48 +00:00
Henrik Andersson
0440d0faca Make use of constants defined in specification instead of
magic character numbers found in protocol stream for clarity.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1828 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-09 12:34:09 +00:00
Henrik Andersson
7ece007132 Fix indentation...
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1778 423420c4-83ab-492f-b58f-81f9feb106b5
2013-12-12 14:01:58 +00:00
Henrik Andersson
013ac6d541 Make sure to check agains null pointer in disk_create()
Simplified FileRenameInformation in disk_set_information()
and handle error if newname is null.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1775 423420c4-83ab-492f-b58f-81f9feb106b5
2013-12-06 13:52:29 +00:00
Henrik Andersson
f0b6604347 Changed rdp_in_unistr() to make dynamic allocation of converted string
instead of using hardcoded buffer sizes and assumtion that conversion
just fits the size.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1773 423420c4-83ab-492f-b58f-81f9feb106b5
2013-12-06 12:43:08 +00:00
Henrik Andersson
2e1dca75f8 Fix indentation.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1702 423420c4-83ab-492f-b58f-81f9feb106b5
2013-03-22 10:20:11 +00:00
Henrik Andersson
5b1e084fe2 Fix crash when a invalid device is received in rdpdr_process_irp.
Thanks goes to David Fries for the patch.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1701 423420c4-83ab-492f-b58f-81f9feb106b5
2013-03-22 10:17:11 +00:00
Henrik Andersson
81641e5b4d Fixes a memoryleak in rdpdr_process_irp upon error.
Thansk goes to David Fries for patches.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1700 423420c4-83ab-492f-b58f-81f9feb106b5
2013-03-22 10:11:00 +00:00
Peter Åstrand
b638882347 Include emails in copyright statements.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1615 423420c4-83ab-492f-b58f-81f9feb106b5
2011-04-13 11:13:04 +00:00
Peter Åstrand
27068f53f8 Updated the copyright notices for the things we have been working on.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1612 423420c4-83ab-492f-b58f-81f9feb106b5
2011-04-13 08:55:42 +00:00
Henrik Andersson
161b4f215a - Remove force flag from rdpdr_init()
- Changes to always start the rdpdr channel
  due assumtions that this channel is supposed
  to always be up and running.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1607 423420c4-83ab-492f-b58f-81f9feb106b5
2011-01-03 13:12:17 +00:00
Henrik Andersson
9dd6bdab95 Fix for sound playback in Windows 2008R2 which requires
the rdpdr channel to be initiated. 
RDPEA nor RDPBCGR mention a relation between audio and
the rdpdr channel.

See. support request #2717082



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1604 423420c4-83ab-492f-b58f-81f9feb106b5
2010-12-20 13:42:51 +00:00
Henrik Andersson
64e4fa886a Cleanup of previous commit that introduced
unrelated changes into commit by mistake.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1603 423420c4-83ab-492f-b58f-81f9feb106b5
2010-12-20 13:14:25 +00:00
Henrik Andersson
7dc38dcca0 Fixed a typo.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1602 423420c4-83ab-492f-b58f-81f9feb106b5
2010-12-20 12:18:41 +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
f6e5fe5f38 Indent fixes
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1428 423420c4-83ab-492f-b58f-81f9feb106b5
2008-01-24 08:06:02 +00:00
Matt Chapman
2e16fa661d Add some more warnings and sanity checks.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1425 423420c4-83ab-492f-b58f-81f9feb106b5
2008-01-05 05:43:02 +00:00
Pierre Ossman
421c2386d3 Improve readability of smart card code.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1414 423420c4-83ab-492f-b58f-81f9feb106b5
2007-07-03 14:08:06 +00:00
Peter Åstrand
75bd1939f8 Improve performance of (large) directory listings: Avoid
stat:ing each file many times.

The patch modifies rdesktop so that the g_notify_stamp is only set
when writing. Also, the stamp is not set before disk_create_notify(),
since this would mean that NotifyInfo would be called twice directly.

With this patch, the number of stat:s has dropped from 24 to 4, using
my tests.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1401 423420c4-83ab-492f-b58f-81f9feb106b5
2007-04-10 11:22:10 +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