Commit Graph

42 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
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
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
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
Peter Åstrand
094f3bac04 Fixed style of a few copyright statements.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1635 423420c4-83ab-492f-b58f-81f9feb106b5
2011-09-28 09:36:59 +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
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
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
ce69fe16be Handle when server sends a failure back for a clipboard request.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1210 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-27 12:29:29 +00:00
Pierre Ossman
ba2f441f18 Control clipboard behaviour (and even disable it) using command line options.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1206 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-27 09:20:24 +00:00
Pierre Ossman
11d219de02 Make a copy of the formats list so that we can properly resend it when the
server is too busy to accept it.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1201 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-27 08:30:15 +00:00
Pierre Ossman
1946b02f65 More clipboard debug output.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1200 423420c4-83ab-492f-b58f-81f9feb106b5
2006-03-27 08:24:41 +00:00
Peter Åstrand
9ea54ea936 Indent fixes
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1027 423420c4-83ab-492f-b58f-81f9feb106b5
2005-11-14 14:46:16 +00:00
Erik Forsberg
95f19ad209 Applied patch 1349027 by Ilya Konstantinov.
Generalizes code for sending clipboard format announces to RDP side,
and uses new code in appropriate places.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1024 423420c4-83ab-492f-b58f-81f9feb106b5
2005-11-07 13:15:19 +00:00
Michael Gernoth
daf84b718f silence warnings when connecting to w2k3 sp1 for now
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@884 423420c4-83ab-492f-b58f-81f9feb106b5
2005-04-14 16:46:13 +00:00
Michael Gernoth
15d76e893d Show frequent cliprdr-errors only when used with WITH_DEBUG_CLIPBOARD
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@555 423420c4-83ab-492f-b58f-81f9feb106b5
2003-12-09 22:07:47 +00:00
Matt Chapman
826ceb5d4a Fix compile warnings on HP-UX.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@535 423420c4-83ab-492f-b58f-81f9feb106b5
2003-10-31 04:29:57 +00:00
Peter Åstrand
7ff54cdd90 Indent fixes
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@434 423420c4-83ab-492f-b58f-81f9feb106b5
2003-07-09 09:18:20 +00:00
Matt Chapman
5b9286e6ea Commit of work in progress on channels (so that other people can hack on
RDPSND), in particular:
* channel layer takes care of virtual channel header
* split X dependent parts out of CLIPRDR, simplified IPC implementation
* initial RDPDR implementation


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@431 423420c4-83ab-492f-b58f-81f9feb106b5
2003-07-01 09:31:25 +00:00
Erik Forsberg
c864378465 Try using STRING instead of TEXT if TEXT doesn't exist in the targets list.
This might solve trouble cutting in X, pasting to Windows when source OS is
(FJK-)IRIX.

There is still a need for better code when selecting format. This is a quick
hack.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@421 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-16 09:03:55 +00:00
Erik Forsberg
38ea9b71e8 Used the wrong variable by mistake when checking whether a format announce
should be sent or not after transferring data X -> Windows.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@419 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-11 09:00:38 +00:00
Erik Forsberg
ebdb982a1f Added headers needed for compilation under FreeBSD (4.8 stable).
Moved DEBUG_CLIPBOARD in cliprdr_send_format_announce.

(Thanks goes to Maikel Verheijen <maikel <at> ladot <dot> com> for pointing
 this out)


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@417 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 12:34:56 +00:00
Erik Forsberg
412f1e6910 Try getting clipboard from CLIPBOARD if there is no owner for PRIMARY.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@401 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 10:39:10 +00:00
Erik Forsberg
b129ced397 Indentation changes
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@395 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:32:56 +00:00
Erik Forsberg
28329bd3fb Moved some debug code.
Fixed a compiler warning by typecasting correctly.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@394 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:32:15 +00:00
Erik Forsberg
2a36b665db Handle transfers rdesktop <-> rdesktop with native windows formats.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@393 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:31:28 +00:00
Erik Forsberg
7a1831445a Free memory when done with clipboard transfer.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@392 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:30:48 +00:00
Erik Forsberg
e52cbfbb39 Handle large clipboard transfers Windows -> X.
Still won't handle transfers that demand INCR on the X side.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@391 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:30:06 +00:00
Erik Forsberg
1052468cf7 Handle large clipboard transfers X->Windows.
Can't handle INCR yet, but at least we handle larger transfers than
1592 bytes.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@390 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:29:01 +00:00
Erik Forsberg
a80b1267a4 Don't hardcode clipboard channel.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@389 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:28:21 +00:00
Erik Forsberg
2281c6b409 Added one to the length of sent data, since XGetProperty is not reporting the
null byte (although space is allocated for it as it seems).

Resend format announces if they fail, with a small delay. Ugly hack, but
it works..


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@388 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:26:49 +00:00
Erik Forsberg
a40cf381b3 Use last button or keypress, either up or down, as event time when aquiring
PRIMARY (and CLIPBOARD).


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@387 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:26:11 +00:00
Erik Forsberg
2bba6ebed8 Send a format announce when we loose ownership of PRIMARY.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@386 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:25:30 +00:00
Erik Forsberg
9d4c22ae10 Rudimentary client->server clipboard transfer.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@385 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:24:15 +00:00
Erik Forsberg
8c019fe34a More proof-of-concept:
* Send a hardcoded string to the server when it wants our clipboard data.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@384 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:23:28 +00:00
Erik Forsberg
3e8d6179ad Proof-of-concept, clipboard transfer server->client works!
A lot of stuff remains for a full implementation.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@383 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:22:25 +00:00
Erik Forsberg
cb7ea96467 Initial revision
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@382 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 09:20:53 +00:00