Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRDP/FreeRDP.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Federa <nfedera@users.noreply.github.com>2017-07-24 11:46:54 +0300
committerGitHub <noreply@github.com>2017-07-24 11:46:54 +0300
commit1648deb435ad52206f7aa2afe4b4dff71d9329bc (patch)
treece7b1d4c8ac4e395f2c7671b2c6a44ebcbcca2d4
parent72cd36c11261007a1ce911fa0600100e688e8256 (diff)
parentf23e10f64b72ad74c3de06343813414bc072f714 (diff)
Merge pull request #4055 from akallabeth/talos_v32.0.0-rc0
Security fixes and code cleanups
-rw-r--r--buildflags.h.in6
-rw-r--r--channels/audin/client/alsa/audin_alsa.c4
-rw-r--r--channels/audin/client/audin_main.c2
-rw-r--r--channels/audin/client/audin_main.h6
-rw-r--r--channels/audin/client/opensles/opensl_io.c2
-rw-r--r--channels/audin/client/opensles/opensl_io.h6
-rw-r--r--channels/audin/client/pulse/audin_pulse.c2
-rw-r--r--channels/client/addin.c4
-rw-r--r--channels/cliprdr/client/cliprdr_format.h6
-rw-r--r--channels/cliprdr/client/cliprdr_main.h6
-rw-r--r--channels/cliprdr/server/cliprdr_main.h6
-rw-r--r--channels/drdynvc/client/drdynvc_main.h6
-rw-r--r--channels/drdynvc/server/drdynvc_main.h6
-rw-r--r--channels/drive/client/drive_file.h6
-rw-r--r--channels/drive/client/drive_main.c22
-rw-r--r--channels/echo/client/echo_main.h6
-rw-r--r--channels/encomsp/server/encomsp_main.h6
-rw-r--r--channels/printer/client/printer_cups.c2
-rw-r--r--channels/printer/client/printer_cups.h6
-rw-r--r--channels/printer/client/printer_main.h6
-rw-r--r--channels/printer/client/printer_win.h6
-rw-r--r--channels/printer/printer.h6
-rw-r--r--channels/rail/client/rail_main.h6
-rw-r--r--channels/rail/client/rail_orders.h6
-rw-r--r--channels/rdpdr/server/rdpdr_main.h6
-rw-r--r--channels/rdpei/server/rdpei_main.h6
-rw-r--r--channels/rdpgfx/client/rdpgfx_codec.c30
-rw-r--r--channels/rdpgfx/client/rdpgfx_main.c2
-rw-r--r--channels/rdpgfx/rdpgfx_common.h6
-rw-r--r--channels/rdpsnd/client/opensles/opensl_io.c2
-rw-r--r--channels/rdpsnd/client/opensles/opensl_io.h6
-rw-r--r--channels/rdpsnd/client/rdpsnd_main.c5
-rw-r--r--channels/rdpsnd/client/rdpsnd_main.h6
-rw-r--r--channels/rdpsnd/server/rdpsnd_main.h6
-rw-r--r--channels/remdesk/server/remdesk_main.h6
-rw-r--r--channels/server/channels.h6
-rw-r--r--channels/smartcard/client/smartcard_pack.c4
-rw-r--r--channels/tsmf/client/gstreamer/tsmf_platform.h6
-rw-r--r--channels/tsmf/client/tsmf_audio.h7
-rw-r--r--channels/tsmf/client/tsmf_codec.h6
-rw-r--r--channels/tsmf/client/tsmf_constants.h7
-rw-r--r--channels/tsmf/client/tsmf_decoder.h7
-rw-r--r--channels/tsmf/client/tsmf_ifman.h6
-rw-r--r--channels/tsmf/client/tsmf_main.h7
-rw-r--r--channels/tsmf/client/tsmf_media.c2
-rw-r--r--channels/tsmf/client/tsmf_media.h6
-rw-r--r--channels/tsmf/client/tsmf_types.h6
-rw-r--r--channels/urbdrc/client/data_transfer.h6
-rw-r--r--channels/urbdrc/client/isoch_queue.h6
-rw-r--r--channels/urbdrc/client/libusb/libusb_udevice.c2
-rw-r--r--channels/urbdrc/client/libusb/libusb_udevice.h6
-rw-r--r--channels/urbdrc/client/libusb/request_queue.h6
-rw-r--r--channels/urbdrc/client/searchman.h6
-rw-r--r--channels/urbdrc/client/urbdrc_main.h6
-rw-r--r--channels/urbdrc/client/urbdrc_types.h6
-rw-r--r--client/Android/android_cliprdr.h6
-rw-r--r--client/Android/android_event.c2
-rw-r--r--client/Android/android_event.h6
-rw-r--r--client/Android/android_freerdp.h6
-rw-r--r--client/Android/android_freerdp_jni.h6
-rw-r--r--client/Android/android_jni_callback.h6
-rw-r--r--client/Android/android_jni_utils.h6
-rw-r--r--client/DirectFB/df_event.h6
-rw-r--r--client/DirectFB/df_graphics.h6
-rw-r--r--client/DirectFB/dfreerdp.h6
-rw-r--r--client/Mac/MRDPView.h6
-rw-r--r--client/Mac/mf_client.h6
-rw-r--r--client/Mac/mfreerdp.h6
-rw-r--r--client/Wayland/wlf_channels.h6
-rw-r--r--client/Wayland/wlf_input.h6
-rw-r--r--client/Wayland/wlfreerdp.c1
-rw-r--r--client/Wayland/wlfreerdp.h6
-rw-r--r--client/Windows/cli/wfreerdp.h6
-rw-r--r--client/Windows/wf_channels.h6
-rw-r--r--client/Windows/wf_client.h6
-rw-r--r--client/Windows/wf_cliprdr.c4
-rw-r--r--client/Windows/wf_cliprdr.h6
-rw-r--r--client/Windows/wf_event.h6
-rw-r--r--client/Windows/wf_floatbar.h6
-rw-r--r--client/Windows/wf_gdi.h6
-rw-r--r--client/Windows/wf_graphics.h6
-rw-r--r--client/Windows/wf_rail.h6
-rw-r--r--client/X11/xf_channels.h6
-rw-r--r--client/X11/xf_client.h6
-rw-r--r--client/X11/xf_cliprdr.c5
-rw-r--r--client/X11/xf_cliprdr.h6
-rw-r--r--client/X11/xf_event.h6
-rw-r--r--client/X11/xf_gdi.c6
-rw-r--r--client/X11/xf_gdi.h6
-rw-r--r--client/X11/xf_gfx.h6
-rw-r--r--client/X11/xf_graphics.h6
-rw-r--r--client/X11/xf_input.h6
-rw-r--r--client/X11/xf_keyboard.h6
-rw-r--r--client/X11/xf_monitor.h6
-rw-r--r--client/X11/xf_rail.h6
-rw-r--r--client/X11/xf_tsmf.h6
-rw-r--r--client/X11/xf_window.h6
-rw-r--r--client/X11/xfreerdp.h6
-rw-r--r--client/common/compatibility.h6
-rw-r--r--client/common/file.c6
-rw-r--r--config.h.in6
-rw-r--r--include/freerdp/channels/rdpei.h6
-rw-r--r--include/freerdp/client/audin.h6
-rw-r--r--include/freerdp/client/channels.h6
-rw-r--r--include/freerdp/client/cliprdr.h6
-rw-r--r--include/freerdp/client/disp.h6
-rw-r--r--include/freerdp/client/drdynvc.h6
-rw-r--r--include/freerdp/client/encomsp.h6
-rw-r--r--include/freerdp/client/rail.h6
-rw-r--r--include/freerdp/client/rdpei.h6
-rw-r--r--include/freerdp/client/rdpgfx.h6
-rw-r--r--include/freerdp/client/rdpsnd.h6
-rw-r--r--include/freerdp/client/remdesk.h6
-rw-r--r--include/freerdp/client/tsmf.h6
-rw-r--r--include/freerdp/codec/region.h6
-rw-r--r--include/freerdp/primitives.h6
-rw-r--r--include/freerdp/server/channels.h6
-rw-r--r--include/freerdp/server/cliprdr.h6
-rw-r--r--include/freerdp/server/drdynvc.h6
-rw-r--r--include/freerdp/server/encomsp.h6
-rw-r--r--include/freerdp/server/rdpdr.h6
-rw-r--r--include/freerdp/server/rdpei.h6
-rw-r--r--include/freerdp/server/rdpgfx.h6
-rw-r--r--include/freerdp/server/remdesk.h6
-rw-r--r--include/freerdp/server/shadow.h10
-rw-r--r--include/freerdp/session.h6
-rw-r--r--include/freerdp/settings.h2
-rw-r--r--include/freerdp/utils/ringbuffer.h6
-rw-r--r--include/freerdp/version.h.in6
-rw-r--r--libfreerdp/codec/nsc_encode.h6
-rw-r--r--libfreerdp/codec/nsc_sse2.h6
-rw-r--r--libfreerdp/codec/nsc_types.h6
-rw-r--r--libfreerdp/codec/planar.c10
-rw-r--r--libfreerdp/codec/progressive.c12
-rw-r--r--libfreerdp/codec/rfx.c3
-rw-r--r--libfreerdp/codec/rfx_bitstream.h6
-rw-r--r--libfreerdp/codec/rfx_constants.h6
-rw-r--r--libfreerdp/codec/rfx_decode.h6
-rw-r--r--libfreerdp/codec/rfx_differential.h6
-rw-r--r--libfreerdp/codec/rfx_dwt.h6
-rw-r--r--libfreerdp/codec/rfx_encode.h6
-rw-r--r--libfreerdp/codec/rfx_neon.h6
-rw-r--r--libfreerdp/codec/rfx_quantization.h6
-rw-r--r--libfreerdp/codec/rfx_rlgr.h6
-rw-r--r--libfreerdp/codec/rfx_sse2.h6
-rw-r--r--libfreerdp/codec/rfx_types.h6
-rw-r--r--libfreerdp/codec/test/TestFreeRDPCodecPlanar.c2
-rw-r--r--libfreerdp/common/assistance.c6
-rw-r--r--libfreerdp/common/settings.c2
-rw-r--r--libfreerdp/core/activation.h6
-rw-r--r--libfreerdp/core/autodetect.h6
-rw-r--r--libfreerdp/core/bulk.h6
-rw-r--r--libfreerdp/core/capabilities.c4
-rw-r--r--libfreerdp/core/capabilities.h6
-rw-r--r--libfreerdp/core/certificate.c19
-rw-r--r--libfreerdp/core/certificate.h8
-rw-r--r--libfreerdp/core/channels.h6
-rw-r--r--libfreerdp/core/client.h6
-rw-r--r--libfreerdp/core/connection.c8
-rw-r--r--libfreerdp/core/connection.h6
-rw-r--r--libfreerdp/core/errinfo.h6
-rw-r--r--libfreerdp/core/fastpath.h6
-rw-r--r--libfreerdp/core/gateway/http.h6
-rw-r--r--libfreerdp/core/gateway/ncacn_http.h6
-rw-r--r--libfreerdp/core/gateway/ntlm.c2
-rw-r--r--libfreerdp/core/gateway/ntlm.h6
-rw-r--r--libfreerdp/core/gateway/rdg.h6
-rw-r--r--libfreerdp/core/gateway/rpc.h6
-rw-r--r--libfreerdp/core/gateway/rpc_bind.h6
-rw-r--r--libfreerdp/core/gateway/rpc_client.h6
-rw-r--r--libfreerdp/core/gateway/rpc_fault.h6
-rw-r--r--libfreerdp/core/gateway/rts.h6
-rw-r--r--libfreerdp/core/gateway/rts_signature.h6
-rw-r--r--libfreerdp/core/gateway/tsg.h6
-rw-r--r--libfreerdp/core/gcc.c31
-rw-r--r--libfreerdp/core/gcc.h6
-rw-r--r--libfreerdp/core/graphics.h6
-rw-r--r--libfreerdp/core/heartbeat.h6
-rw-r--r--libfreerdp/core/info.c4
-rw-r--r--libfreerdp/core/info.h6
-rw-r--r--libfreerdp/core/input.h6
-rw-r--r--libfreerdp/core/license.c69
-rw-r--r--libfreerdp/core/license.h47
-rw-r--r--libfreerdp/core/listener.h6
-rw-r--r--libfreerdp/core/mcs.c11
-rw-r--r--libfreerdp/core/mcs.h6
-rw-r--r--libfreerdp/core/message.c14
-rw-r--r--libfreerdp/core/message.h6
-rw-r--r--libfreerdp/core/multitransport.h6
-rw-r--r--libfreerdp/core/nego.c7
-rw-r--r--libfreerdp/core/nego.h6
-rw-r--r--libfreerdp/core/nla.c2
-rw-r--r--libfreerdp/core/nla.h6
-rw-r--r--libfreerdp/core/orders.h6
-rw-r--r--libfreerdp/core/peer.c6
-rw-r--r--libfreerdp/core/peer.h6
-rw-r--r--libfreerdp/core/proxy.c2
-rw-r--r--libfreerdp/core/proxy.h6
-rw-r--r--libfreerdp/core/rdp.c43
-rw-r--r--libfreerdp/core/rdp.h10
-rw-r--r--libfreerdp/core/redirection.c2
-rw-r--r--libfreerdp/core/redirection.h6
-rw-r--r--libfreerdp/core/security.c12
-rw-r--r--libfreerdp/core/security.h18
-rw-r--r--libfreerdp/core/server.h6
-rw-r--r--libfreerdp/core/settings.c8
-rw-r--r--libfreerdp/core/surface.h6
-rw-r--r--libfreerdp/core/tcp.h6
-rw-r--r--libfreerdp/core/timezone.h6
-rw-r--r--libfreerdp/core/tpdu.h6
-rw-r--r--libfreerdp/core/tpkt.c23
-rw-r--r--libfreerdp/core/tpkt.h8
-rw-r--r--libfreerdp/core/transport.h6
-rw-r--r--libfreerdp/core/update.c4
-rw-r--r--libfreerdp/core/update.h6
-rw-r--r--libfreerdp/core/window.h6
-rw-r--r--libfreerdp/crypto/crypto.c6
-rw-r--r--libfreerdp/crypto/opensslcompat.h6
-rw-r--r--libfreerdp/gdi/brush.h6
-rw-r--r--libfreerdp/gdi/clipping.h6
-rw-r--r--libfreerdp/gdi/drawing.h6
-rw-r--r--libfreerdp/gdi/gdi.h6
-rw-r--r--libfreerdp/gdi/gfx.c4
-rw-r--r--libfreerdp/gdi/graphics.h6
-rw-r--r--libfreerdp/gdi/line.h6
-rw-r--r--libfreerdp/locale/keyboard_layout.c2
-rw-r--r--libfreerdp/locale/keyboard_xkbfile.h6
-rw-r--r--libfreerdp/locale/liblocale.h6
-rw-r--r--libfreerdp/locale/xkb_layout_ids.h6
-rw-r--r--libfreerdp/primitives/prim_internal.h10
-rw-r--r--libfreerdp/primitives/prim_templates.h6
-rw-r--r--libfreerdp/primitives/test/TestPrimitivesYCbCr.c2
-rw-r--r--libfreerdp/primitives/test/TestPrimitivesYCoCg.c2
-rw-r--r--libfreerdp/primitives/test/prim_test.h6
-rw-r--r--rdtk/librdtk/rdtk_surface.c2
-rw-r--r--rdtk/sample/rdtk_x11.c2
-rw-r--r--server/Mac/mf_audin.h6
-rw-r--r--server/Mac/mf_event.h10
-rw-r--r--server/Mac/mf_info.h10
-rw-r--r--server/Mac/mf_input.h6
-rw-r--r--server/Mac/mf_interface.h6
-rw-r--r--server/Mac/mf_mountain_lion.h6
-rw-r--r--server/Mac/mf_peer.h6
-rw-r--r--server/Mac/mf_rdpsnd.h6
-rw-r--r--server/Mac/mfreerdp.h6
-rw-r--r--server/Sample/sf_audin.h6
-rw-r--r--server/Sample/sf_encomsp.h6
-rw-r--r--server/Sample/sf_rdpsnd.h6
-rw-r--r--server/Sample/sfreerdp.c5
-rw-r--r--server/Sample/sfreerdp.h6
-rw-r--r--server/Windows/cli/wfreerdp.h6
-rw-r--r--server/Windows/wf_directsound.h6
-rw-r--r--server/Windows/wf_dxgi.h6
-rw-r--r--server/Windows/wf_info.h10
-rw-r--r--server/Windows/wf_input.h6
-rw-r--r--server/Windows/wf_interface.h14
-rw-r--r--server/Windows/wf_mirage.h6
-rw-r--r--server/Windows/wf_peer.h6
-rw-r--r--server/Windows/wf_rdpsnd.h6
-rw-r--r--server/Windows/wf_settings.h6
-rw-r--r--server/Windows/wf_update.h6
-rw-r--r--server/Windows/wf_wasapi.c2
-rw-r--r--server/Windows/wf_wasapi.h6
-rw-r--r--server/shadow/Mac/mac_shadow.h6
-rw-r--r--server/shadow/Win/win_dxgi.h6
-rw-r--r--server/shadow/Win/win_rdp.h6
-rw-r--r--server/shadow/Win/win_shadow.h6
-rw-r--r--server/shadow/Win/win_wds.h6
-rw-r--r--server/shadow/X11/x11_shadow.c58
-rw-r--r--server/shadow/X11/x11_shadow.h28
-rw-r--r--server/shadow/shadow.h6
-rw-r--r--server/shadow/shadow_audin.h6
-rw-r--r--server/shadow/shadow_capture.c15
-rw-r--r--server/shadow/shadow_capture.h6
-rw-r--r--server/shadow/shadow_channels.h6
-rw-r--r--server/shadow/shadow_client.c5
-rw-r--r--server/shadow/shadow_client.h6
-rw-r--r--server/shadow/shadow_encoder.c4
-rw-r--r--server/shadow/shadow_encoder.h6
-rw-r--r--server/shadow/shadow_encomsp.h6
-rw-r--r--server/shadow/shadow_input.h6
-rw-r--r--server/shadow/shadow_lobby.h6
-rw-r--r--server/shadow/shadow_mcevent.h6
-rw-r--r--server/shadow/shadow_rdpgfx.h6
-rw-r--r--server/shadow/shadow_rdpsnd.h6
-rw-r--r--server/shadow/shadow_remdesk.h6
-rw-r--r--server/shadow/shadow_screen.h6
-rw-r--r--server/shadow/shadow_subsystem.c6
-rw-r--r--server/shadow/shadow_subsystem.h8
-rw-r--r--server/shadow/shadow_surface.c4
-rw-r--r--server/shadow/shadow_surface.h6
-rw-r--r--uwac/include/uwac/uwac-tools.h6
-rw-r--r--uwac/include/uwac/uwac.h6
-rw-r--r--uwac/libuwac/uwac-os.h6
-rw-r--r--uwac/libuwac/uwac-priv.h6
-rw-r--r--uwac/libuwac/uwac-utils.h6
-rw-r--r--winpr/libwinpr/clipboard/clipboard.c4
-rw-r--r--winpr/libwinpr/clipboard/synthetic.c2
-rw-r--r--winpr/libwinpr/comm/test/TestGetCommState.c2
-rw-r--r--winpr/libwinpr/crt/test/TestUnicodeConversion.c2
-rw-r--r--winpr/libwinpr/crypto/test/TestCryptoCertEnumCertificatesInStore.c2
-rw-r--r--winpr/libwinpr/dsparse/test/TestDsMakeSpn.c2
-rw-r--r--winpr/libwinpr/environment/environment.c4
-rw-r--r--winpr/libwinpr/file/test/TestFileFindFirstFile.c2
-rw-r--r--winpr/libwinpr/file/test/TestFileFindNextFile.c2
-rw-r--r--winpr/libwinpr/nt/nt.c2
-rw-r--r--winpr/libwinpr/smartcard/smartcard_pcsc.c4
-rw-r--r--winpr/libwinpr/sspi/sspi_winpr.c6
-rw-r--r--winpr/libwinpr/thread/argv.c4
-rw-r--r--winpr/libwinpr/utils/collections/ArrayList.c2
-rw-r--r--winpr/libwinpr/utils/collections/BufferPool.c6
-rw-r--r--winpr/libwinpr/utils/collections/ObjectPool.c2
-rw-r--r--winpr/libwinpr/utils/collections/PubSub.c2
-rw-r--r--winpr/libwinpr/utils/collections/Stack.c2
-rw-r--r--winpr/libwinpr/utils/debug.c2
-rw-r--r--winpr/libwinpr/utils/ini.c2
-rw-r--r--winpr/libwinpr/utils/lodepng/lodepng.c16
-rw-r--r--winpr/libwinpr/utils/ntlm.c12
-rw-r--r--winpr/tools/makecert/makecert.c4
319 files changed, 1122 insertions, 1029 deletions
diff --git a/buildflags.h.in b/buildflags.h.in
index 0b8b31092..0cc4a64a5 100644
--- a/buildflags.h.in
+++ b/buildflags.h.in
@@ -1,5 +1,5 @@
-#ifndef _FREERDP_BUILD_FLAGS_H
-#define _FREERDP_BUILD_FLAGS_H
+#ifndef FREERDP_BUILD_FLAGS_H
+#define FREERDP_BUILD_FLAGS_H
#define CFLAGS "${CMAKE_C_FLAGS}"
#define COMPILER_ID "${CMAKE_C_COMPILER_ID}"
@@ -8,4 +8,4 @@
#define BUILD_CONFIG "${FREERDP_BUILD_CONFIG}"
#define BUILD_TYPE "${CMAKE_BUILD_TYPE}"
-#endif /*_FREERDP_BUILD_FLAGS_H */
+#endif /* FREERDP_BUILD_FLAGS_H */
diff --git a/channels/audin/client/alsa/audin_alsa.c b/channels/audin/client/alsa/audin_alsa.c
index e1e0001e0..a9566a541 100644
--- a/channels/audin/client/alsa/audin_alsa.c
+++ b/channels/audin/client/alsa/audin_alsa.c
@@ -229,7 +229,7 @@ static void* audin_alsa_thread_func(void* arg)
DWORD status;
DEBUG_DVC("in");
rbytes_per_frame = alsa->actual_channels * alsa->bytes_per_channel;
- buffer = (BYTE*) calloc(1, rbytes_per_frame * alsa->frames_per_packet);
+ buffer = (BYTE*) calloc(alsa->frames_per_packet, rbytes_per_frame);
if (!buffer)
{
@@ -410,7 +410,7 @@ static UINT audin_alsa_open(IAudinDevice* device, AudinReceive receive,
alsa->receive = receive;
alsa->user_data = user_data;
tbytes_per_frame = alsa->target_channels * alsa->bytes_per_channel;
- alsa->buffer = (BYTE*) calloc(1, tbytes_per_frame * alsa->frames_per_packet);
+ alsa->buffer = (BYTE*) calloc(alsa->frames_per_packet, tbytes_per_frame);
if (!alsa->buffer)
{
diff --git a/channels/audin/client/audin_main.c b/channels/audin/client/audin_main.c
index 2a0a552bf..5ee2fea18 100644
--- a/channels/audin/client/audin_main.c
+++ b/channels/audin/client/audin_main.c
@@ -164,7 +164,7 @@ static UINT audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback,
}
Stream_Seek_UINT32(s); /* cbSizeFormatsPacket */
- callback->formats = (audinFormat*) calloc(1, NumFormats * sizeof(audinFormat));
+ callback->formats = (audinFormat*) calloc(NumFormats, sizeof(audinFormat));
if (!callback->formats)
{
diff --git a/channels/audin/client/audin_main.h b/channels/audin/client/audin_main.h
index 50a0b6c12..419986c03 100644
--- a/channels/audin/client/audin_main.h
+++ b/channels/audin/client/audin_main.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_AUDIN_CLIENT_MAIN_H
-#define FREERDP_AUDIN_CLIENT_MAIN_H
+#ifndef FREERDP_CHANNEL_AUDIN_CLIENT_MAIN_H
+#define FREERDP_CHANNEL_AUDIN_CLIENT_MAIN_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -38,5 +38,5 @@
#define DEBUG_DVC(...) do { } while (0)
#endif
-#endif /* FREERDP_AUDIN_CLIENT_MAIN_H */
+#endif /* FREERDP_CHANNEL_AUDIN_CLIENT_MAIN_H */
diff --git a/channels/audin/client/opensles/opensl_io.c b/channels/audin/client/opensles/opensl_io.c
index 27f964c96..d12662b96 100644
--- a/channels/audin/client/opensles/opensl_io.c
+++ b/channels/audin/client/opensles/opensl_io.c
@@ -253,7 +253,7 @@ OPENSL_STREAM* android_OpenRecDevice(char* name, int sr, int inchannels,
int bufferframes, int bits_per_sample)
{
OPENSL_STREAM* p;
- p = (OPENSL_STREAM*) calloc(sizeof(OPENSL_STREAM), 1);
+ p = (OPENSL_STREAM*) calloc(1, sizeof(OPENSL_STREAM));
if (!p)
return NULL;
diff --git a/channels/audin/client/opensles/opensl_io.h b/channels/audin/client/opensles/opensl_io.h
index 7d8d33f22..259b55a81 100644
--- a/channels/audin/client/opensles/opensl_io.h
+++ b/channels/audin/client/opensles/opensl_io.h
@@ -27,8 +27,8 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef OPENSL_IO
-#define OPENSL_IO
+#ifndef FREERDP_CHANNEL_AUDIN_CLIENT_OPENSL_IO_H
+#define FREERDP_CHANNEL_AUDIN_CLIENT_OPENSL_IO_H
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
@@ -93,4 +93,4 @@ FREERDP_LOCAL int android_RecIn(OPENSL_STREAM* p, short* buffer, int size);
};
#endif
-#endif // #ifndef OPENSL_IO
+#endif /* FREERDP_CHANNEL_AUDIN_CLIENT_OPENSL_IO_H */
diff --git a/channels/audin/client/pulse/audin_pulse.c b/channels/audin/client/pulse/audin_pulse.c
index d854dca44..da12128bf 100644
--- a/channels/audin/client/pulse/audin_pulse.c
+++ b/channels/audin/client/pulse/audin_pulse.c
@@ -496,7 +496,7 @@ static UINT audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u
pa_threaded_mainloop_unlock(pulse->mainloop);
freerdp_dsp_context_reset_adpcm(pulse->dsp_context);
- pulse->buffer = calloc(1, pulse->bytes_per_frame * pulse->frames_per_packet);
+ pulse->buffer = calloc(pulse->frames_per_packet, pulse->bytes_per_frame);
if (!pulse->buffer)
{
diff --git a/channels/client/addin.c b/channels/client/addin.c
index 14dda2798..11e1fb890 100644
--- a/channels/client/addin.c
+++ b/channels/client/addin.c
@@ -93,7 +93,7 @@ FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPSTR pszName, LPSTR
FREERDP_ADDIN** ppAddins = NULL;
STATIC_SUBSYSTEM_ENTRY* subsystems;
nAddins = 0;
- ppAddins = (FREERDP_ADDIN**) calloc(1, sizeof(FREERDP_ADDIN*) * 128);
+ ppAddins = (FREERDP_ADDIN**) calloc(128, sizeof(FREERDP_ADDIN*));
if (!ppAddins)
{
@@ -216,7 +216,7 @@ FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPSTR pszName, LPSTR pszSub
hFind = FindFirstFileA(pszSearchPath, &FindData);
free(pszSearchPath);
nAddins = 0;
- ppAddins = (FREERDP_ADDIN**) calloc(1, sizeof(FREERDP_ADDIN*) * 128);
+ ppAddins = (FREERDP_ADDIN**) calloc(128, sizeof(FREERDP_ADDIN*));
if (!ppAddins)
{
diff --git a/channels/cliprdr/client/cliprdr_format.h b/channels/cliprdr/client/cliprdr_format.h
index 11fb1bebf..dfe6965bb 100644
--- a/channels/cliprdr/client/cliprdr_format.h
+++ b/channels/cliprdr/client/cliprdr_format.h
@@ -20,12 +20,12 @@
* limitations under the License.
*/
-#ifndef __CLIPRDR_FORMAT_H
-#define __CLIPRDR_FORMAT_H
+#ifndef FREERDP_CHANNEL_CLIPRDR_CLIENT_FORMAT_H
+#define FREERDP_CHANNEL_CLIPRDR_CLIENT_FORMAT_H
UINT cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags);
UINT cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags);
UINT cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags);
UINT cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags);
-#endif /* __CLIPRDR_FORMAT_H */
+#endif /* FREERDP_CHANNEL_CLIPRDR_CLIENT_FORMAT_H */
diff --git a/channels/cliprdr/client/cliprdr_main.h b/channels/cliprdr/client/cliprdr_main.h
index e994f38fe..25bad1828 100644
--- a/channels/cliprdr/client/cliprdr_main.h
+++ b/channels/cliprdr/client/cliprdr_main.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __CLIPRDR_MAIN_H
-#define __CLIPRDR_MAIN_H
+#ifndef FREERDP_CHANNEL_CLIPRDR_CLIENT_MAIN_H
+#define FREERDP_CHANNEL_CLIPRDR_CLIENT_MAIN_H
#include <winpr/stream.h>
@@ -60,4 +60,4 @@ CliprdrClientContext* cliprdr_get_client_interface(cliprdrPlugin* cliprdr);
#define DEBUG_CLIPRDR(...) do { } while (0)
#endif
-#endif /* __CLIPRDR_MAIN_H */
+#endif /* FREERDP_CHANNEL_CLIPRDR_CLIENT_MAIN_H */
diff --git a/channels/cliprdr/server/cliprdr_main.h b/channels/cliprdr/server/cliprdr_main.h
index 362d85a83..248f34109 100644
--- a/channels/cliprdr/server/cliprdr_main.h
+++ b/channels/cliprdr/server/cliprdr_main.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_CLIPRDR_MAIN_H
-#define FREERDP_CHANNEL_SERVER_CLIPRDR_MAIN_H
+#ifndef FREERDP_CHANNEL_CLIPRDR_SERVER_MAIN_H
+#define FREERDP_CHANNEL_CLIPRDR_SERVER_MAIN_H
#include <winpr/crt.h>
#include <winpr/synch.h>
@@ -45,4 +45,4 @@ struct _cliprdr_server_private
};
typedef struct _cliprdr_server_private CliprdrServerPrivate;
-#endif /* FREERDP_CHANNEL_SERVER_CLIPRDR_MAIN_H */
+#endif /* FREERDP_CHANNEL_CLIPRDR_SERVER_MAIN_H */
diff --git a/channels/drdynvc/client/drdynvc_main.h b/channels/drdynvc/client/drdynvc_main.h
index 261fcd86e..1d83582bc 100644
--- a/channels/drdynvc/client/drdynvc_main.h
+++ b/channels/drdynvc/client/drdynvc_main.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __DRDYNVC_MAIN_H
-#define __DRDYNVC_MAIN_H
+#ifndef FREERDP_CHANNEL_DRDYNVC_CLIENT_MAIN_H
+#define FREERDP_CHANNEL_DRDYNVC_CLIENT_MAIN_H
#include <winpr/wlog.h>
#include <winpr/synch.h>
@@ -137,4 +137,4 @@ struct drdynvc_plugin
IWTSVirtualChannelManager* channel_mgr;
};
-#endif
+#endif /* FREERDP_CHANNEL_DRDYNVC_CLIENT_MAIN_H */
diff --git a/channels/drdynvc/server/drdynvc_main.h b/channels/drdynvc/server/drdynvc_main.h
index aa69b5706..8e17f89c2 100644
--- a/channels/drdynvc/server/drdynvc_main.h
+++ b/channels/drdynvc/server/drdynvc_main.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_DRDYNVC_MAIN_H
-#define FREERDP_CHANNEL_SERVER_DRDYNVC_MAIN_H
+#ifndef FREERDP_CHANNEL_DRDYNVC_SERVER_MAIN_H
+#define FREERDP_CHANNEL_DRDYNVC_SERVER_MAIN_H
#include <winpr/crt.h>
#include <winpr/synch.h>
@@ -34,4 +34,4 @@ struct _drdynvc_server_private
void* ChannelHandle;
};
-#endif /* FREERDP_CHANNEL_SERVER_DRDYNVC_MAIN_H */
+#endif /* FREERDP_CHANNEL_DRDYNVC_SERVER_MAIN_H */
diff --git a/channels/drive/client/drive_file.h b/channels/drive/client/drive_file.h
index 3cc914562..9b2eed4cc 100644
--- a/channels/drive/client/drive_file.h
+++ b/channels/drive/client/drive_file.h
@@ -23,8 +23,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_DRIVE_FILE_H
-#define FREERDP_CHANNEL_DRIVE_FILE_H
+#ifndef FREERDP_CHANNEL_DRIVE_CLIENT_FILE_H
+#define FREERDP_CHANNEL_DRIVE_CLIENT_FILE_H
#include <winpr/stream.h>
#include <freerdp/channels/log.h>
@@ -68,4 +68,4 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT
extern UINT sys_code_page;
-#endif /* FREERDP_CHANNEL_DRIVE_FILE_H */
+#endif /* FREERDP_CHANNEL_DRIVE_CLIENT_FILE_H */
diff --git a/channels/drive/client/drive_main.c b/channels/drive/client/drive_main.c
index e873ff954..1e6eca73a 100644
--- a/channels/drive/client/drive_main.c
+++ b/channels/drive/client/drive_main.c
@@ -735,6 +735,19 @@ static UINT drive_irp_request(DEVICE* device, IRP* irp)
return CHANNEL_RC_OK;
}
+static void drive_free_resources(DRIVE_DEVICE* drive)
+{
+ if (!drive)
+ return;
+
+ CloseHandle(drive->thread);
+ ListDictionary_Free(drive->files);
+ MessageQueue_Free(drive->IrpQueue);
+ Stream_Free(drive->device.data, TRUE);
+ free(drive->path);
+ free(drive);
+}
+
/**
* Function description
*
@@ -753,12 +766,7 @@ static UINT drive_free(DEVICE* device)
return error;
}
- CloseHandle(drive->thread);
- ListDictionary_Free(drive->files);
- MessageQueue_Free(drive->IrpQueue);
- Stream_Free(drive->device.data, TRUE);
- free(drive->path);
- free(drive);
+ drive_free_resources(drive);
return error;
}
@@ -866,7 +874,7 @@ UINT drive_register_drive_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints,
return CHANNEL_RC_OK;
out_error:
- drive_free((DEVICE*) drive);
+ drive_free_resources(drive);
return error;
}
diff --git a/channels/echo/client/echo_main.h b/channels/echo/client/echo_main.h
index 565142fd5..04cda415a 100644
--- a/channels/echo/client/echo_main.h
+++ b/channels/echo/client/echo_main.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __ECHO_MAIN_H
-#define __ECHO_MAIN_H
+#ifndef FREERDP_CHANNEL_ECHO_CLIENT_MAIN_H
+#define FREERDP_CHANNEL_ECHO_CLIENT_MAIN_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -36,5 +36,5 @@
#define DEBUG_DVC(...) do { } while (0)
#endif
-#endif /* __ECHO_MAIN_H */
+#endif /* FREERDP_CHANNEL_ECHO_CLIENT_MAIN_H */
diff --git a/channels/encomsp/server/encomsp_main.h b/channels/encomsp/server/encomsp_main.h
index 1338f6ee0..18daf72ef 100644
--- a/channels/encomsp/server/encomsp_main.h
+++ b/channels/encomsp/server/encomsp_main.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_ENCOMSP_MAIN_H
-#define FREERDP_CHANNEL_SERVER_ENCOMSP_MAIN_H
+#ifndef FREERDP_CHANNEL_ENCOMSP_SERVER_MAIN_H
+#define FREERDP_CHANNEL_ENCOMSP_SERVER_MAIN_H
#include <winpr/crt.h>
#include <winpr/synch.h>
@@ -33,4 +33,4 @@ struct _encomsp_server_private
void* ChannelHandle;
};
-#endif /* FREERDP_CHANNEL_SERVER_ENCOMSP_MAIN_H */
+#endif /* FREERDP_CHANNEL_ENCOMSP_SERVER_MAIN_H */
diff --git a/channels/printer/client/printer_cups.c b/channels/printer/client/printer_cups.c
index 2c09c8732..d6f0705d6 100644
--- a/channels/printer/client/printer_cups.c
+++ b/channels/printer/client/printer_cups.c
@@ -281,7 +281,7 @@ static rdpPrinter** printer_cups_enum_printers(rdpPrinterDriver* driver)
int i;
num_dests = cupsGetDests(&dests);
- printers = (rdpPrinter**) calloc(1, sizeof(rdpPrinter*) * (num_dests + 1));
+ printers = (rdpPrinter**) calloc(num_dests + 1, sizeof(rdpPrinter*));
if (!printers)
return NULL;
diff --git a/channels/printer/client/printer_cups.h b/channels/printer/client/printer_cups.h
index 434d64aba..876cb47d7 100644
--- a/channels/printer/client/printer_cups.h
+++ b/channels/printer/client/printer_cups.h
@@ -17,12 +17,12 @@
* limitations under the License.
*/
-#ifndef __PRINTER_CUPS_H
-#define __PRINTER_CUPS_H
+#ifndef FREERDP_CHANNEL_PRINTER_CLIENT_CUPS_H
+#define FREERDP_CHANNEL_PRINTER_CLIENT_CUPS_H
#include "printer_main.h"
rdpPrinterDriver* printer_cups_get_driver(void);
-#endif
+#endif /* FREERDP_CHANNEL_PRINTER_CLIENT_CUPS_H */
diff --git a/channels/printer/client/printer_main.h b/channels/printer/client/printer_main.h
index 3d9b75a9d..dfb56d8e0 100644
--- a/channels/printer/client/printer_main.h
+++ b/channels/printer/client/printer_main.h
@@ -20,8 +20,8 @@
* limitations under the License.
*/
-#ifndef __PRINTER_MAIN_H
-#define __PRINTER_MAIN_H
+#ifndef FREERDP_CHANNEL_PRINTER_CLIENT_MAIN_H
+#define FREERDP_CHANNEL_PRINTER_CLIENT_MAIN_H
#include <freerdp/channels/rdpdr.h>
@@ -66,4 +66,4 @@ struct rdp_print_job
pcClosePrintJob Close;
};
-#endif
+#endif /* FREERDP_CHANNEL_PRINTER_CLIENT_MAIN_H */
diff --git a/channels/printer/client/printer_win.h b/channels/printer/client/printer_win.h
index c0a0420f2..22777d0af 100644
--- a/channels/printer/client/printer_win.h
+++ b/channels/printer/client/printer_win.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __PRINTER_WIN_H
-#define __PRINTER_WIN_H
+#ifndef FREERDP_CHANNEL_PRINTER_CLIENT_WIN_H
+#define FREERDP_CHANNEL_PRINTER_CLIENT_WIN_H
#include <freerdp/channels/log.h>
@@ -31,5 +31,5 @@ rdpPrinterDriver* printer_win_get_driver(void);
#define DEBUG_WINPR(...) do { } while (0)
#endif
-#endif
+#endif /* FREERDP_CHANNEL_PRINTER_CLIENT_WIN_H */
diff --git a/channels/printer/printer.h b/channels/printer/printer.h
index 237313009..5ce8f5e45 100644
--- a/channels/printer/printer.h
+++ b/channels/printer/printer.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __CHANNELS_PRINTER_PRINTER_H_
-#define __CHANNELS_PRINTER_PRINTER_H_
+#ifndef FREERDP_CHANNEL_PRINTER_PRINTER_H
+#define FREERDP_CHANNEL_PRINTER_PRINTER_H
/* SERVER_PRINTER_CACHE_EVENT.cachedata */
#define RDPDR_ADD_PRINTER_EVENT 0x00000001
@@ -34,4 +34,4 @@
#define RDPDR_PRINTER_ANNOUNCE_FLAG_XPSFORMAT 0x00000010
-#endif /* __CHANNELS_PRINTER_PRINTER_H_ */
+#endif /* FREERDP_CHANNEL_PRINTER_PRINTER_H */
diff --git a/channels/rail/client/rail_main.h b/channels/rail/client/rail_main.h
index e581a3842..86e752fa4 100644
--- a/channels/rail/client/rail_main.h
+++ b/channels/rail/client/rail_main.h
@@ -21,8 +21,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_RAIL_MAIN_H
-#define FREERDP_CHANNEL_CLIENT_RAIL_MAIN_H
+#ifndef FREERDP_CHANNEL_RAIL_CLIENT_MAIN_H
+#define FREERDP_CHANNEL_RAIL_CLIENT_MAIN_H
#include <freerdp/rail.h>
#include <freerdp/svc.h>
@@ -56,4 +56,4 @@ typedef struct rail_plugin railPlugin;
RailClientContext* rail_get_client_interface(railPlugin* rail);
UINT rail_send_channel_data(railPlugin* rail, void* data, size_t length);
-#endif /* FREERDP_CHANNEL_CLIENT_RAIL_MAIN_H */
+#endif /* FREERDP_CHANNEL_RAIL_CLIENT_MAIN_H */
diff --git a/channels/rail/client/rail_orders.h b/channels/rail/client/rail_orders.h
index d7e807b9e..dab414b08 100644
--- a/channels/rail/client/rail_orders.h
+++ b/channels/rail/client/rail_orders.h
@@ -20,8 +20,8 @@
* limitations under the License.
*/
-#ifndef __RAIL_ORDERS_H
-#define __RAIL_ORDERS_H
+#ifndef FREERDP_CHANNEL_RAIL_CLIENT_ORDERS_H
+#define FREERDP_CHANNEL_RAIL_CLIENT_ORDERS_H
#include <freerdp/channels/log.h>
@@ -64,4 +64,4 @@ UINT rail_send_client_window_move_order(railPlugin* rail, RAIL_WINDOW_MOVE_ORDER
UINT rail_send_client_get_appid_req_order(railPlugin* rail, RAIL_GET_APPID_REQ_ORDER* getAppIdReq);
UINT rail_send_client_langbar_info_order(railPlugin* rail, RAIL_LANGBAR_INFO_ORDER* langBarInfo);
-#endif /* __RAIL_ORDERS_H */
+#endif /* FREERDP_CHANNEL_RAIL_CLIENT_ORDERS_H */
diff --git a/channels/rdpdr/server/rdpdr_main.h b/channels/rdpdr/server/rdpdr_main.h
index dc09aadf3..035ff7d70 100644
--- a/channels/rdpdr/server/rdpdr_main.h
+++ b/channels/rdpdr/server/rdpdr_main.h
@@ -20,8 +20,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_RDPDR_MAIN_H
-#define FREERDP_CHANNEL_SERVER_RDPDR_MAIN_H
+#ifndef FREERDP_CHANNEL_RDPDR_SERVER_MAIN_H
+#define FREERDP_CHANNEL_RDPDR_SERVER_MAIN_H
#include <winpr/collections.h>
#include <winpr/crt.h>
@@ -86,4 +86,4 @@ struct _RDPDR_IRP
};
typedef struct _RDPDR_IRP RDPDR_IRP;
-#endif /* FREERDP_CHANNEL_SERVER_RDPDR_MAIN_H */
+#endif /* FREERDP_CHANNEL_RDPDR_SERVER_MAIN_H */
diff --git a/channels/rdpei/server/rdpei_main.h b/channels/rdpei/server/rdpei_main.h
index 81ad29396..f6505f54d 100644
--- a/channels/rdpei/server/rdpei_main.h
+++ b/channels/rdpei/server/rdpei_main.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __FREERDP_CHANNEL_SERVER_RDPEI_MAIN_H_
-#define __FREERDP_CHANNEL_SERVER_RDPEI_MAIN_H_
+#ifndef FREERDP_CHANNEL_RDPEI_SERVER_MAIN_H
+#define FREERDP_CHANNEL_RDPEI_SERVER_MAIN_H
#include <winpr/crt.h>
#include <winpr/synch.h>
@@ -31,5 +31,5 @@
-#endif /* FREERDP_CHANNEL_SERVER_RDPEI_MAIN_H_ */
+#endif /* FREERDP_CHANNEL_RDPEI_SERVER_MAIN_H */
diff --git a/channels/rdpgfx/client/rdpgfx_codec.c b/channels/rdpgfx/client/rdpgfx_codec.c
index 525dad0e3..0ea15a394 100644
--- a/channels/rdpgfx/client/rdpgfx_codec.c
+++ b/channels/rdpgfx/client/rdpgfx_codec.c
@@ -63,7 +63,7 @@ static UINT rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s,
goto error_out;
}
- meta->regionRects = (RECTANGLE_16*) malloc(meta->numRegionRects * sizeof(RECTANGLE_16));
+ meta->regionRects = (RECTANGLE_16*) calloc(meta->numRegionRects, sizeof(RECTANGLE_16));
if (!meta->regionRects)
{
@@ -72,7 +72,7 @@ static UINT rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s,
goto error_out;
}
- meta->quantQualityVals = (RDPGFX_H264_QUANT_QUALITY*) malloc(meta->numRegionRects * sizeof(
+ meta->quantQualityVals = (RDPGFX_H264_QUANT_QUALITY*) calloc(meta->numRegionRects, sizeof(
RDPGFX_H264_QUANT_QUALITY));
if (!meta->quantQualityVals)
@@ -182,8 +182,9 @@ static UINT rdpgfx_decode_AVC444(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd
UINT32 tmp;
size_t pos1, pos2;
wStream* s;
- RDPGFX_AVC444_BITMAP_STREAM h264;
+ RDPGFX_AVC444_BITMAP_STREAM h264 = { 0 };
RdpgfxClientContext* context = (RdpgfxClientContext*) gfx->iface.pInterface;
+
s = Stream_New(cmd->data, cmd->length);
if (!s)
@@ -193,21 +194,26 @@ static UINT rdpgfx_decode_AVC444(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd
}
if (Stream_GetRemainingLength(s) < 4)
- return ERROR_INVALID_DATA;
-
+ {
+ error = ERROR_INVALID_DATA;
+ goto fail;
+ }
Stream_Read_UINT32(s, tmp);
h264.cbAvc420EncodedBitstream1 = tmp & 0x3FFFFFFFUL;
h264.LC = (tmp >> 30UL) & 0x03UL;
if (h264.LC == 0x03)
- return ERROR_INVALID_DATA;
+ {
+ error = ERROR_INVALID_DATA;
+ goto fail;
+ }
pos1 = Stream_GetPosition(s);
if ((error = rdpgfx_read_h264_metablock(gfx, s, &(h264.bitstream[0].meta))))
{
WLog_ERR(TAG, "rdpgfx_read_h264_metablock failed with error %"PRIu32"!", error);
- return error;
+ goto fail;
}
pos2 = Stream_GetPosition(s);
@@ -218,7 +224,10 @@ static UINT rdpgfx_decode_AVC444(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd
tmp = h264.cbAvc420EncodedBitstream1 - pos2 + pos1;
if (Stream_GetRemainingLength(s) < tmp)
- return ERROR_INVALID_DATA;
+ {
+ error = ERROR_INVALID_DATA;
+ goto fail;
+ }
h264.bitstream[0].length = tmp;
Stream_Seek(s, tmp);
@@ -226,7 +235,7 @@ static UINT rdpgfx_decode_AVC444(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd
if ((error = rdpgfx_read_h264_metablock(gfx, s, &(h264.bitstream[1].meta))))
{
WLog_ERR(TAG, "rdpgfx_read_h264_metablock failed with error %"PRIu32"!", error);
- return error;
+ goto fail;
}
h264.bitstream[1].data = Stream_Pointer(s);
@@ -238,7 +247,6 @@ static UINT rdpgfx_decode_AVC444(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd
memset(&h264.bitstream[1], 0, sizeof(h264.bitstream[1]));
}
- Stream_Free(s, FALSE);
cmd->extra = (void*) &h264;
if (context)
@@ -249,6 +257,8 @@ static UINT rdpgfx_decode_AVC444(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd
WLog_ERR(TAG, "context->SurfaceCommand failed with error %"PRIu32"", error);
}
+fail:
+ Stream_Free(s, FALSE);
free(h264.bitstream[0].meta.regionRects);
free(h264.bitstream[0].meta.quantQualityVals);
free(h264.bitstream[1].meta.regionRects);
diff --git a/channels/rdpgfx/client/rdpgfx_main.c b/channels/rdpgfx/client/rdpgfx_main.c
index 815e08dcb..ec9501516 100644
--- a/channels/rdpgfx/client/rdpgfx_main.c
+++ b/channels/rdpgfx/client/rdpgfx_main.c
@@ -1593,7 +1593,7 @@ static UINT rdpgfx_get_surface_ids(RdpgfxClientContext* context,
return CHANNEL_RC_OK;
}
- pSurfaceIds = (UINT16*) malloc(count * sizeof(UINT16));
+ pSurfaceIds = (UINT16*) calloc(count, sizeof(UINT16));
if (!pSurfaceIds)
{
diff --git a/channels/rdpgfx/rdpgfx_common.h b/channels/rdpgfx/rdpgfx_common.h
index 161a1e256..d9d7270c0 100644
--- a/channels/rdpgfx/rdpgfx_common.h
+++ b/channels/rdpgfx/rdpgfx_common.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_RDPGFX_CLIENT_COMMON_H
-#define FREERDP_CHANNEL_RDPGFX_CLIENT_COMMON_H
+#ifndef FREERDP_CHANNEL_RDPGFX_COMMON_H
+#define FREERDP_CHANNEL_RDPGFX_COMMON_H
#include <winpr/crt.h>
#include <winpr/stream.h>
@@ -43,5 +43,5 @@ FREERDP_LOCAL UINT rdpgfx_write_rect16(wStream* s, RECTANGLE_16* rect16);
FREERDP_LOCAL UINT rdpgfx_read_color32(wStream* s, RDPGFX_COLOR32* color32);
FREERDP_LOCAL UINT rdpgfx_write_color32(wStream* s, RDPGFX_COLOR32* color32);
-#endif /* FREERDP_CHANNEL_RDPGFX_CLIENT_COMMON_H */
+#endif /* FREERDP_CHANNEL_RDPGFX_COMMON_H */
diff --git a/channels/rdpsnd/client/opensles/opensl_io.c b/channels/rdpsnd/client/opensles/opensl_io.c
index 191caecc1..ffc24e12c 100644
--- a/channels/rdpsnd/client/opensles/opensl_io.c
+++ b/channels/rdpsnd/client/opensles/opensl_io.c
@@ -264,7 +264,7 @@ OPENSL_STREAM* android_OpenAudioDevice(int sr, int outchannels,
int bufferframes)
{
OPENSL_STREAM* p;
- p = (OPENSL_STREAM*) calloc(sizeof(OPENSL_STREAM), 1);
+ p = (OPENSL_STREAM*) calloc(1, sizeof(OPENSL_STREAM));
if (!p)
return NULL;
diff --git a/channels/rdpsnd/client/opensles/opensl_io.h b/channels/rdpsnd/client/opensles/opensl_io.h
index 00e4f12c1..0bb121a53 100644
--- a/channels/rdpsnd/client/opensles/opensl_io.h
+++ b/channels/rdpsnd/client/opensles/opensl_io.h
@@ -27,8 +27,8 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef OPENSL_IO
-#define OPENSL_IO
+#ifndef FREERDP_CHANNEL_RDPSND_CLIENT_OPENSL_IO_H
+#define FREERDP_CHANNEL_RDPSND_CLIENT_OPENSL_IO_H
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
@@ -108,4 +108,4 @@ FREERDP_LOCAL BOOL android_SetOutputVolume(OPENSL_STREAM* p, int level);
};
#endif
-#endif // #ifndef OPENSL_IO
+#endif /* FREERDP_CHANNEL_RDPSND_CLIENT_OPENSL_IO_H */
diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c
index 70a5e26d9..172128d58 100644
--- a/channels/rdpsnd/client/rdpsnd_main.c
+++ b/channels/rdpsnd/client/rdpsnd_main.c
@@ -223,8 +223,9 @@ static void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
if (!rdpsnd->NumberOfServerFormats)
return;
- rdpsnd->ClientFormats = (AUDIO_FORMAT*) calloc(sizeof(AUDIO_FORMAT),
- rdpsnd->NumberOfServerFormats);
+ rdpsnd->ClientFormats = (AUDIO_FORMAT*) calloc(
+ rdpsnd->NumberOfServerFormats,
+ sizeof(AUDIO_FORMAT));
if (!rdpsnd->ClientFormats)
return;
diff --git a/channels/rdpsnd/client/rdpsnd_main.h b/channels/rdpsnd/client/rdpsnd_main.h
index dcd976f45..81cb426be 100644
--- a/channels/rdpsnd/client/rdpsnd_main.h
+++ b/channels/rdpsnd/client/rdpsnd_main.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __RDPSND_MAIN_H
-#define __RDPSND_MAIN_H
+#ifndef FREERDP_CHANNEL_RDPSND_CLIENT_MAIN_H
+#define FREERDP_CHANNEL_RDPSND_CLIENT_MAIN_H
#include <freerdp/api.h>
#include <freerdp/svc.h>
@@ -37,4 +37,4 @@
UINT rdpsnd_virtual_channel_write(rdpsndPlugin* rdpsnd, wStream* s);
-#endif /* __RDPSND_MAIN_H */
+#endif /* FREERDP_CHANNEL_RDPSND_CLIENT_MAIN_H */
diff --git a/channels/rdpsnd/server/rdpsnd_main.h b/channels/rdpsnd/server/rdpsnd_main.h
index 797eaaf08..f058abbc7 100644
--- a/channels/rdpsnd/server/rdpsnd_main.h
+++ b/channels/rdpsnd/server/rdpsnd_main.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_RDPSND_MAIN_H
-#define FREERDP_CHANNEL_SERVER_RDPSND_MAIN_H
+#ifndef FREERDP_CHANNEL_RDPSND_SERVER_MAIN_H
+#define FREERDP_CHANNEL_RDPSND_SERVER_MAIN_H
#include <winpr/crt.h>
#include <winpr/synch.h>
@@ -55,4 +55,4 @@ struct _rdpsnd_server_private
CRITICAL_SECTION lock; /* Protect out_buffer and related parameters */
};
-#endif /* FREERDP_CHANNEL_SERVER_RDPSND_MAIN_H */
+#endif /* FREERDP_CHANNEL_RDPSND_SERVER_MAIN_H */
diff --git a/channels/remdesk/server/remdesk_main.h b/channels/remdesk/server/remdesk_main.h
index 3c35b45a6..857376ae5 100644
--- a/channels/remdesk/server/remdesk_main.h
+++ b/channels/remdesk/server/remdesk_main.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_REMDESK_MAIN_H
-#define FREERDP_CHANNEL_SERVER_REMDESK_MAIN_H
+#ifndef FREERDP_CHANNEL_REMDESK_SERVER_MAIN_H
+#define FREERDP_CHANNEL_REMDESK_SERVER_MAIN_H
#include <winpr/crt.h>
#include <winpr/synch.h>
@@ -38,5 +38,5 @@ struct _remdesk_server_private
UINT32 Version;
};
-#endif /* FREERDP_CHANNEL_SERVER_REMDESK_MAIN_H */
+#endif /* FREERDP_CHANNEL_REMDESK_SERVER_MAIN_H */
diff --git a/channels/server/channels.h b/channels/server/channels.h
index 96a295da4..f054c919f 100644
--- a/channels/server/channels.h
+++ b/channels/server/channels.h
@@ -18,9 +18,9 @@
* limitations under the License.
*/
-#ifndef __WTSVC_H
-#define __WTSVC_H
+#ifndef FREERDP_CHANNEL_SERVER_CHANNELS_H
+#define FREERDP_CHANNEL_SERVER_CHANNELS_H
-#endif /* __WTSVC_H */
+#endif /* FREERDP_CHANNEL_SERVER_CHANNELS_H */
diff --git a/channels/smartcard/client/smartcard_pack.c b/channels/smartcard/client/smartcard_pack.c
index 560330a58..1f89d5431 100644
--- a/channels/smartcard/client/smartcard_pack.c
+++ b/channels/smartcard/client/smartcard_pack.c
@@ -981,7 +981,7 @@ LONG smartcard_unpack_connect_w_call(SMARTCARD_DEVICE* smartcard, wStream* s, Co
Stream_Seek_UINT32(s); /* NdrMaxCount (4 bytes) */
Stream_Seek_UINT32(s); /* NdrOffset (4 bytes) */
Stream_Read_UINT32(s, count); /* NdrActualCount (4 bytes) */
- call->szReader = (WCHAR*) malloc((count + 1) * 2);
+ call->szReader = (WCHAR*) calloc((count + 1), 2);
if (!call->szReader)
{
@@ -1557,7 +1557,7 @@ LONG smartcard_unpack_get_status_change_w_call(SMARTCARD_DEVICE* smartcard, wStr
return STATUS_BUFFER_TOO_SMALL;
}
- readerState->szReader = (WCHAR*) malloc((count + 1) * 2);
+ readerState->szReader = (WCHAR*) calloc((count + 1), 2);
if (!readerState->szReader)
{
diff --git a/channels/tsmf/client/gstreamer/tsmf_platform.h b/channels/tsmf/client/gstreamer/tsmf_platform.h
index 0d6fc5aa0..7fb6be1f7 100644
--- a/channels/tsmf/client/gstreamer/tsmf_platform.h
+++ b/channels/tsmf/client/gstreamer/tsmf_platform.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef _TSMF_PLATFORM_H_
-#define _TSMF_PLATFORM_H_
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_GST_PLATFORM_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_GST_PLATFORM_H
#include <gst/gst.h>
#include <tsmf_decoder.h>
@@ -84,4 +84,4 @@ int tsmf_window_unmap(TSMFGstreamerDecoder* decoder);
BOOL tsmf_gstreamer_add_pad(TSMFGstreamerDecoder* mdecoder);
void tsmf_gstreamer_remove_pad(TSMFGstreamerDecoder* mdecoder);
-#endif
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_GST_PLATFORM_H */
diff --git a/channels/tsmf/client/tsmf_audio.h b/channels/tsmf/client/tsmf_audio.h
index ac90ee289..a8c7a49be 100644
--- a/channels/tsmf/client/tsmf_audio.h
+++ b/channels/tsmf/client/tsmf_audio.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __TSMF_AUDIO_H
-#define __TSMF_AUDIO_H
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_AUDIO_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_AUDIO_H
#include "tsmf_types.h"
@@ -47,5 +47,4 @@ typedef ITSMFAudioDevice* (*TSMF_AUDIO_DEVICE_ENTRY) (void);
ITSMFAudioDevice* tsmf_load_audio_device(const char* name, const char* device);
-#endif
-
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_AUDIO_H */
diff --git a/channels/tsmf/client/tsmf_codec.h b/channels/tsmf/client/tsmf_codec.h
index 0dd419837..a678ea41c 100644
--- a/channels/tsmf/client/tsmf_codec.h
+++ b/channels/tsmf/client/tsmf_codec.h
@@ -17,13 +17,13 @@
* limitations under the License.
*/
-#ifndef __TSMF_CODEC
-#define __TSMF_CODEC
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_CODEC_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_CODEC_H
#include "tsmf_types.h"
BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s);
BOOL tsmf_codec_check_media_type(const char* decoder_name, wStream* s);
-#endif
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_CODEC_H */
diff --git a/channels/tsmf/client/tsmf_constants.h b/channels/tsmf/client/tsmf_constants.h
index 3ca92f645..d84370a2a 100644
--- a/channels/tsmf/client/tsmf_constants.h
+++ b/channels/tsmf/client/tsmf_constants.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __TSMF_CONSTANTS_H
-#define __TSMF_CONSTANTS_H
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_CONSTANTS_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_CONSTANTS_H
#define GUID_SIZE 16
#define TSMF_BUFFER_PADDING_SIZE 8
@@ -136,5 +136,4 @@
#define TSMF_FORMAT_TYPE_VIDEOINFO2 4
#define TSMF_FORMAT_TYPE_MPEG1VIDEOINFO 5
-#endif
-
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_CONSTANTS_H */
diff --git a/channels/tsmf/client/tsmf_decoder.h b/channels/tsmf/client/tsmf_decoder.h
index e4c71dac6..a12e8ceeb 100644
--- a/channels/tsmf/client/tsmf_decoder.h
+++ b/channels/tsmf/client/tsmf_decoder.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __TSMF_DECODER_H
-#define __TSMF_DECODER_H
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_DECODER_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_DECODER_H
#include "tsmf_types.h"
@@ -72,5 +72,4 @@ typedef ITSMFDecoder *(*TSMF_DECODER_ENTRY)(void);
ITSMFDecoder *tsmf_load_decoder(const char *name, TS_AM_MEDIA_TYPE *media_type);
BOOL tsmf_check_decoder_available(const char* name);
-#endif
-
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_DECODER_H */
diff --git a/channels/tsmf/client/tsmf_ifman.h b/channels/tsmf/client/tsmf_ifman.h
index 84d0406bc..b6986205a 100644
--- a/channels/tsmf/client/tsmf_ifman.h
+++ b/channels/tsmf/client/tsmf_ifman.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __TSMF_IFMAN_H
-#define __TSMF_IFMAN_H
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_IFMAN_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_IFMAN_H
#include <freerdp/freerdp.h>
@@ -66,5 +66,5 @@ UINT tsmf_ifman_on_playback_restarted(TSMF_IFMAN* ifman);
UINT tsmf_ifman_on_playback_stopped(TSMF_IFMAN* ifman);
UINT tsmf_ifman_on_playback_rate_changed(TSMF_IFMAN* ifman);
-#endif
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_IFMAN_H */
diff --git a/channels/tsmf/client/tsmf_main.h b/channels/tsmf/client/tsmf_main.h
index db3c94582..0143d29f3 100644
--- a/channels/tsmf/client/tsmf_main.h
+++ b/channels/tsmf/client/tsmf_main.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __TSMF_MAIN_H
-#define __TSMF_MAIN_H
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_MAIN_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_MAIN_H
#include <freerdp/freerdp.h>
@@ -68,5 +68,4 @@ BOOL tsmf_send_eos_response(IWTSVirtualChannelCallback* pChannelCallback, UINT32
BOOL tsmf_playback_ack(IWTSVirtualChannelCallback* pChannelCallback,
UINT32 message_id, UINT64 duration, UINT32 data_size);
-#endif
-
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_MAIN_H */
diff --git a/channels/tsmf/client/tsmf_media.c b/channels/tsmf/client/tsmf_media.c
index f79294968..2609efbd5 100644
--- a/channels/tsmf/client/tsmf_media.c
+++ b/channels/tsmf/client/tsmf_media.c
@@ -465,7 +465,7 @@ static BOOL tsmf_sample_playback_video(TSMF_SAMPLE* sample)
if (presentation->nr_rects > 0)
{
event.numVisibleRects = presentation->nr_rects;
- event.visibleRects = (RECTANGLE_16*) calloc(1, event.numVisibleRects * sizeof(RECTANGLE_16));
+ event.visibleRects = (RECTANGLE_16*) calloc(event.numVisibleRects, sizeof(RECTANGLE_16));
if (!event.visibleRects)
{
diff --git a/channels/tsmf/client/tsmf_media.h b/channels/tsmf/client/tsmf_media.h
index 3a08b1c6a..3ab21ddc5 100644
--- a/channels/tsmf/client/tsmf_media.h
+++ b/channels/tsmf/client/tsmf_media.h
@@ -25,8 +25,8 @@
* streams in each presentation.
*/
-#ifndef __TSMF_MEDIA_H
-#define __TSMF_MEDIA_H
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_MEDIA_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_MEDIA_H
#include <freerdp/freerdp.h>
@@ -69,5 +69,5 @@ BOOL tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pC
BOOL tsmf_media_init(void);
void tsmf_stream_start_threads(TSMF_STREAM* stream);
-#endif
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_MEDIA_H */
diff --git a/channels/tsmf/client/tsmf_types.h b/channels/tsmf/client/tsmf_types.h
index cdda3371c..a6833f03f 100644
--- a/channels/tsmf/client/tsmf_types.h
+++ b/channels/tsmf/client/tsmf_types.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __TSMF_TYPES_H
-#define __TSMF_TYPES_H
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_TYPES_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_TYPES_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -57,5 +57,5 @@ typedef struct _TS_AM_MEDIA_TYPE
UINT32 ExtraDataSize;
} TS_AM_MEDIA_TYPE;
-#endif
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_TYPES_H */
diff --git a/channels/urbdrc/client/data_transfer.h b/channels/urbdrc/client/data_transfer.h
index e7bd8ac3f..bc3d70860 100644
--- a/channels/urbdrc/client/data_transfer.h
+++ b/channels/urbdrc/client/data_transfer.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __DATA_TRANSFER_H
-#define __DATA_TRANSFER_H
+#ifndef FREERDP_CHANNEL_URBDRC_CLIENT_DATA_TRANSFER_H
+#define FREERDP_CHANNEL_URBDRC_CLIENT_DATA_TRANSFER_H
#include "urbdrc_main.h"
@@ -31,5 +31,5 @@
void *urbdrc_process_udev_data_transfer(void* arg);
-#endif
+#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_DATA_TRANSFER_H */
diff --git a/channels/urbdrc/client/isoch_queue.h b/channels/urbdrc/client/isoch_queue.h
index 4a01cdc08..90ab1a162 100644
--- a/channels/urbdrc/client/isoch_queue.h
+++ b/channels/urbdrc/client/isoch_queue.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __ISOCH_QUEUE_H
-#define __ISOCH_QUEUE_H
+#ifndef FREERDP_CHANNEL_URBDRC_CLIENT_ISOCH_QUEUE_H
+#define FREERDP_CHANNEL_URBDRC_CLIENT_ISOCH_QUEUE_H
#include "urbdrc_types.h"
@@ -66,4 +66,4 @@ ISOCH_CALLBACK_QUEUE* isoch_queue_new(void);
-#endif /* __ISOCH_QUEUE_H */
+#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_ISOCH_QUEUE_H */
diff --git a/channels/urbdrc/client/libusb/libusb_udevice.c b/channels/urbdrc/client/libusb/libusb_udevice.c
index 3ac327250..62ddb786a 100644
--- a/channels/urbdrc/client/libusb/libusb_udevice.c
+++ b/channels/urbdrc/client/libusb/libusb_udevice.c
@@ -759,7 +759,7 @@ static MSUSB_CONFIG_DESCRIPTOR* libusb_udev_complete_msconfig_setup(IUDEVICE* id
LibusbInterface = &LibusbConfig->interface[MsInterface->InterfaceNumber];
LibusbAltsetting = &LibusbInterface->altsetting[MsInterface->AlternateSetting];
LibusbNumEndpoint = LibusbAltsetting->bNumEndpoints;
- t_MsPipes = (MSUSB_PIPE_DESCRIPTOR**) malloc(LibusbNumEndpoint * sizeof(MSUSB_PIPE_DESCRIPTOR*));
+ t_MsPipes = (MSUSB_PIPE_DESCRIPTOR**) calloc(LibusbNumEndpoint, sizeof(MSUSB_PIPE_DESCRIPTOR*));
for (pnum = 0; pnum < LibusbNumEndpoint; pnum++)
{
diff --git a/channels/urbdrc/client/libusb/libusb_udevice.h b/channels/urbdrc/client/libusb/libusb_udevice.h
index d753039ce..c79dfcad5 100644
--- a/channels/urbdrc/client/libusb/libusb_udevice.h
+++ b/channels/urbdrc/client/libusb/libusb_udevice.h
@@ -20,8 +20,8 @@
-#ifndef __LIBUSB_UDEVICE_H
-#define __LIBUSB_UDEVICE_H
+#ifndef FREERDP_CHANNEL_URBDRC_CLIENT_LIBUSB_UDEVICE_H
+#define FREERDP_CHANNEL_URBDRC_CLIENT_LIBUSB_UDEVICE_H
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#include <libusb.h>
@@ -82,4 +82,4 @@ IUDEVICE* udev_new_by_addr(int bus_number, int dev_number);
extern int libusb_debug;
-#endif /* __LIBUSB_UDEVICE_H */
+#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_LIBUSB_UDEVICE_H */
diff --git a/channels/urbdrc/client/libusb/request_queue.h b/channels/urbdrc/client/libusb/request_queue.h
index e10e7ae70..35e80c5d1 100644
--- a/channels/urbdrc/client/libusb/request_queue.h
+++ b/channels/urbdrc/client/libusb/request_queue.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __REQUEST_QUEUE_H
-#define __REQUEST_QUEUE_H
+#ifndef FREERDP_CHANNEL_URBDRC_CLIENT_LIBUSB_REQUEST_QUEUE_H
+#define FREERDP_CHANNEL_URBDRC_CLIENT_LIBUSB_REQUEST_QUEUE_H
#include "urbdrc_types.h"
@@ -62,4 +62,4 @@ struct _REQUEST_QUEUE
REQUEST_QUEUE* request_queue_new(void);
-#endif /* __REQUEST_QUEUE_H */
+#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_LIBUSB_REQUEST_QUEUE_H */
diff --git a/channels/urbdrc/client/searchman.h b/channels/urbdrc/client/searchman.h
index 483e7bc48..b449a989f 100644
--- a/channels/urbdrc/client/searchman.h
+++ b/channels/urbdrc/client/searchman.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __SEACH_MAN_H
-#define __SEACH_MAN_H
+#ifndef FREERDP_CHANNEL_URBDRC_CLIENT_SEARCHMAN_H
+#define FREERDP_CHANNEL_URBDRC_CLIENT_SEARCHMAN_H
#include "urbdrc_types.h"
@@ -74,5 +74,5 @@ struct _USB_SEARCHMAN
USB_SEARCHMAN* searchman_new(void* urbdrc, UINT32 UsbDevice);
-#endif
+#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_SEARCHMAN_H */
diff --git a/channels/urbdrc/client/urbdrc_main.h b/channels/urbdrc/client/urbdrc_main.h
index c51f17dce..129b84435 100644
--- a/channels/urbdrc/client/urbdrc_main.h
+++ b/channels/urbdrc/client/urbdrc_main.h
@@ -20,8 +20,8 @@
-#ifndef __URBDRC_MAIN_H
-#define __URBDRC_MAIN_H
+#ifndef FREERDP_CHANNEL_URBDRC_CLIENT_MAIN_H
+#define FREERDP_CHANNEL_URBDRC_CLIENT_MAIN_H
#include "searchman.h"
#include "isoch_queue.h"
@@ -224,4 +224,4 @@ struct _IUDEVMAN
void (*wait_urb) (IUDEVMAN* idevman);
};
-#endif /* __URBDRC_MAIN_H */
+#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_MAIN_H */
diff --git a/channels/urbdrc/client/urbdrc_types.h b/channels/urbdrc/client/urbdrc_types.h
index 78c550ea1..204cadec3 100644
--- a/channels/urbdrc/client/urbdrc_types.h
+++ b/channels/urbdrc/client/urbdrc_types.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __URBDRC_TYPES_H
-#define __URBDRC_TYPES_H
+#ifndef FREERDP_CHANNEL_URBDRC_CLIENT_TYPES_H
+#define FREERDP_CHANNEL_URBDRC_CLIENT_TYPES_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -330,4 +330,4 @@ enum device_descriptor_table
_t = (_tp.tv_sec * 1000) + (_tp.tv_usec / 1000); \
} while (0)
-#endif /* __URBDRC_TYPES_H */
+#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_TYPES_H */
diff --git a/client/Android/android_cliprdr.h b/client/Android/android_cliprdr.h
index f7fdd6006..af142c20b 100644
--- a/client/Android/android_cliprdr.h
+++ b/client/Android/android_cliprdr.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __ANDROID_CLIPRDR_H__
-#define __ANDROID_CLIPRDR_H__
+#ifndef FREERDP_CLIENT_ANDROID_CLIPRDR_H
+#define FREERDP_CLIENT_ANDROID_CLIPRDR_H
#include <freerdp/client/cliprdr.h>
#include <freerdp/api.h>
@@ -33,4 +33,4 @@ FREERDP_LOCAL BOOL android_cliprdr_init(androidContext* afc,
FREERDP_LOCAL BOOL android_cliprdr_uninit(androidContext* afc,
CliprdrClientContext* cliprdr);
-#endif /* __ANDROID_CLIPRDR_H__ */
+#endif /* FREERDP_CLIENT_ANDROID_CLIPRDR_H */
diff --git a/client/Android/android_event.c b/client/Android/android_event.c
index 19b246c34..de04157c3 100644
--- a/client/Android/android_event.c
+++ b/client/Android/android_event.c
@@ -309,7 +309,7 @@ BOOL android_event_queue_init(freerdp* inst)
return FALSE;
}
- queue->events = (ANDROID_EVENT**) calloc(sizeof(ANDROID_EVENT*), queue->size);
+ queue->events = (ANDROID_EVENT**) calloc(queue->size, sizeof(ANDROID_EVENT*));
if (!queue->events)
{
diff --git a/client/Android/android_event.h b/client/Android/android_event.h
index 38e00f372..584d67206 100644
--- a/client/Android/android_event.h
+++ b/client/Android/android_event.h
@@ -9,8 +9,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef FREERDP_ANDROID_EVENT_H
-#define FREERDP_ANDROID_EVENT_H
+#ifndef FREERDP_CLIENT_ANDROID_EVENT_H
+#define FREERDP_CLIENT_ANDROID_EVENT_H
#include <freerdp/freerdp.h>
#include <freerdp/api.h>
@@ -79,4 +79,4 @@ FREERDP_LOCAL void android_event_free(ANDROID_EVENT* event);
FREERDP_LOCAL BOOL android_event_queue_init(freerdp* inst);
FREERDP_LOCAL void android_event_queue_uninit(freerdp* inst);
-#endif /* FREERDP_ANDROID_EVENT_H */
+#endif /* FREERDP_CLIENT_ANDROID_EVENT_H */
diff --git a/client/Android/android_freerdp.h b/client/Android/android_freerdp.h
index 5c15ee72c..ac8ca897b 100644
--- a/client/Android/android_freerdp.h
+++ b/client/Android/android_freerdp.h
@@ -7,8 +7,8 @@
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef __ANDROID_FREERDP_H
-#define __ANDROID_FREERDP_H
+#ifndef FREERDP_CLIENT_ANDROID_FREERDP_H
+#define FREERDP_CLIENT_ANDROID_FREERDP_H
#include <jni.h>
@@ -40,6 +40,6 @@ struct android_context
};
typedef struct android_context androidContext;
-#endif /* __ANDROID_FREERDP_H */
+#endif /* FREERDP_CLIENT_ANDROID_FREERDP_H */
diff --git a/client/Android/android_freerdp_jni.h b/client/Android/android_freerdp_jni.h
index bd949bdd5..5bf48a24f 100644
--- a/client/Android/android_freerdp_jni.h
+++ b/client/Android/android_freerdp_jni.h
@@ -17,12 +17,12 @@
limitations under the License.
*/
-#ifndef __ANDROID_FREERDP_JNI_H
-#define __ANDROID_FREERDP_JNI_H
+#ifndef FREERDP_CLIENT_ANDROID_FREERDP_JNI_H
+#define FREERDP_CLIENT_ANDROID_FREERDP_JNI_H
#define JAVA_LIBFREERDP_CLASS "com/freerdp/freerdpcore/services/LibFreeRDP"
#define JAVA_CONTEXT_CLASS "android/content/Context"
#define JAVA_FILE_CLASS "java/io/File"
-#endif /* __ANDROID_FREERDP_JNI_H */
+#endif /* FREERDP_CLIENT_ANDROID_FREERDP_JNI_H */
diff --git a/client/Android/android_jni_callback.h b/client/Android/android_jni_callback.h
index 98af6f78b..7f91306e3 100644
--- a/client/Android/android_jni_callback.h
+++ b/client/Android/android_jni_callback.h
@@ -10,8 +10,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef FREERDP_ANDROID_JNI_CALLBACK_H
-#define FREERDP_ANDROID_JNI_CALLBACK_H
+#ifndef FREERDP_CLIENT_ANDROID_JNI_CALLBACK_H
+#define FREERDP_CLIENT_ANDROID_JNI_CALLBACK_H
#include <jni.h>
#include <stdarg.h>
@@ -27,5 +27,5 @@ FREERDP_LOCAL jboolean freerdp_callback_bool_result(const char* callback,
FREERDP_LOCAL jint freerdp_callback_int_result(const char* callback,
const char* signature, ...);
-#endif /* FREERDP_ANDROID_JNI_CALLBACK_H */
+#endif /* FREERDP_CLIENT_ANDROID_JNI_CALLBACK_H */
diff --git a/client/Android/android_jni_utils.h b/client/Android/android_jni_utils.h
index 12816aeda..5414e3301 100644
--- a/client/Android/android_jni_utils.h
+++ b/client/Android/android_jni_utils.h
@@ -9,8 +9,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef _ANDROID_JNI_UTILS_H_
-#define _ANDROID_JNI_UTILS_H_
+#ifndef FREERDP_CLIENT_ANDROID_JNI_UTILS_H
+#define FREERDP_CLIENT_ANDROID_JNI_UTILS_H
#include <jni.h>
#include <freerdp/api.h>
@@ -34,4 +34,4 @@ FREERDP_LOCAL extern JavaVM* g_JavaVm;
}
#endif
-#endif /* _ANDROID_JNI_UTILS_H_ */
+#endif /* FREERDP_CLIENT_ANDROID_JNI_UTILS_H */
diff --git a/client/DirectFB/df_event.h b/client/DirectFB/df_event.h
index 8e4cc773b..fc00674f3 100644
--- a/client/DirectFB/df_event.h
+++ b/client/DirectFB/df_event.h
@@ -17,12 +17,12 @@
* limitations under the License.
*/
-#ifndef __DF_EVENT_H
-#define __DF_EVENT_H
+#ifndef FREERDP_CLIENT_DF_EVENT_H
+#define FREERDP_CLIENT_DF_EVENT_H
#include "dfreerdp.h"
void df_keyboard_init(void);
BOOL df_event_process(freerdp* instance, DFBEvent* event);
-#endif /* __DF_EVENT_H */
+#endif /* FREERDP_CLIENT_DF_EVENT_H */
diff --git a/client/DirectFB/df_graphics.h b/client/DirectFB/df_graphics.h
index 8185b948b..bf9066843 100644
--- a/client/DirectFB/df_graphics.h
+++ b/client/DirectFB/df_graphics.h
@@ -17,11 +17,11 @@
* limitations under the License.
*/
-#ifndef __DF_GRAPHICS_H
-#define __DF_GRAPHICS_H
+#ifndef FREERDP_CLIENT_DF_GRAPHICS_H
+#define FREERDP_CLIENT_DF_GRAPHICS_H
#include "dfreerdp.h"
void df_register_graphics(rdpGraphics* graphics);
-#endif /* __DF_GRAPHICS_H */
+#endif /* FREERDP_CLIENT_DF_GRAPHICS_H */
diff --git a/client/DirectFB/dfreerdp.h b/client/DirectFB/dfreerdp.h
index 6b14bf997..544619bf8 100644
--- a/client/DirectFB/dfreerdp.h
+++ b/client/DirectFB/dfreerdp.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __DFREERDP_H
-#define __DFREERDP_H
+#ifndef FREERDP_CLIENT_DF_FREERDP_H
+#define FREERDP_CLIENT_DF_FREERDP_H
#include "config.h"
#include <freerdp/freerdp.h>
@@ -67,4 +67,4 @@ struct df_info
IDirectFBEventBuffer* event_buffer;
};
-#endif /* __DFREERDP_H */
+#endif /* FREERDP_CLIENT_DF_FREERDP_H */
diff --git a/client/Mac/MRDPView.h b/client/Mac/MRDPView.h
index 63cea7888..60e47d8f1 100644
--- a/client/Mac/MRDPView.h
+++ b/client/Mac/MRDPView.h
@@ -1,5 +1,5 @@
-#ifndef MRDPVIEW_H
-#define MRDPVIEW_H
+#ifndef FREERDP_CLIENT_MAC_MRDPVIEW_H
+#define FREERDP_CLIENT_MAC_MRDPVIEW_H
/**
* FreeRDP: A Remote Desktop Protocol Implementation
@@ -85,4 +85,4 @@ BOOL mac_post_connect(freerdp* instance);
BOOL mac_authenticate(freerdp* instance, char** username, char** password,
char** domain);
-#endif // MRDPVIEW_H
+#endif /* FREERDP_CLIENT_MAC_MRDPVIEW_H */
diff --git a/client/Mac/mf_client.h b/client/Mac/mf_client.h
index 341fcacbc..79712cc55 100644
--- a/client/Mac/mf_client.h
+++ b/client/Mac/mf_client.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __MF_CLIENT_H
-#define __MF_CLIENT_H
+#ifndef FREERDP_CLIENT_MAC_CLIENT_H
+#define FREERDP_CLIENT_MAC_CLIENT_H
#include <freerdp/client.h>
@@ -40,4 +40,4 @@ FREERDP_API int RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
}
#endif
-#endif
+#endif /* FREERDP_CLIENT_MAC_CLIENT_H */
diff --git a/client/Mac/mfreerdp.h b/client/Mac/mfreerdp.h
index c0b59d677..d263a0392 100644
--- a/client/Mac/mfreerdp.h
+++ b/client/Mac/mfreerdp.h
@@ -1,5 +1,5 @@
-#ifndef MFREERDP_H
-#define MFREERDP_H
+#ifndef FREERDP_CLIENT_MAC_FREERDP_H
+#define FREERDP_CLIENT_MAC_FREERDP_H
typedef struct mf_context mfContext;
@@ -86,4 +86,4 @@ struct mf_context
int yMaxScroll; // maximum vertical scroll value
};
-#endif // MFREERDP_H
+#endif /* FREERDP_CLIENT_MAC_FREERDP_H */
diff --git a/client/Wayland/wlf_channels.h b/client/Wayland/wlf_channels.h
index b0e2ff19a..d3d47d25a 100644
--- a/client/Wayland/wlf_channels.h
+++ b/client/Wayland/wlf_channels.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef WLF_CHANNELS_H
-#define WLF_CHANNELS_H
+#ifndef FREERDP_CLIENT_WAYLAND_CHANNELS_H
+#define FREERDP_CLIENT_WAYLAND_CHANNELS_H
#include <freerdp/freerdp.h>
#include <freerdp/client/channels.h>
@@ -39,4 +39,4 @@ void wlf_OnChannelConnectedEventHandler(rdpContext* context,
void wlf_OnChannelDisconnectedEventHandler(rdpContext* context,
ChannelDisconnectedEventArgs* e);
-#endif
+#endif /* FREERDP_CLIENT_WAYLAND_CHANNELS_H */
diff --git a/client/Wayland/wlf_input.h b/client/Wayland/wlf_input.h
index 2e26ab89a..701edf582 100644
--- a/client/Wayland/wlf_input.h
+++ b/client/Wayland/wlf_input.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __WLF_INPUT_H
-#define __WLF_INPUT_H
+#ifndef FREERDP_CLIENT_WAYLAND_INPUT_H
+#define FREERDP_CLIENT_WAYLAND_INPUT_H
#include <freerdp/freerdp.h>
#include <freerdp/gdi/gdi.h>
@@ -35,4 +35,4 @@ BOOL wlf_handle_pointer_axis(freerdp* instance, UwacPointerAxisEvent* ev);
BOOL wlf_handle_key(freerdp* instance, UwacKeyEvent* ev);
BOOL wlf_keyboard_enter(freerdp* instance, UwacKeyboardEnterLeaveEvent* ev);
-#endif /* __WLF_INPUT_H */
+#endif /* FREERDP_CLIENT_WAYLAND_INPUT_H */
diff --git a/client/Wayland/wlfreerdp.c b/client/Wayland/wlfreerdp.c
index f6a56bfed..4dccc37e9 100644
--- a/client/Wayland/wlfreerdp.c
+++ b/client/Wayland/wlfreerdp.c
@@ -28,6 +28,7 @@
#include <freerdp/gdi/gdi.h>
#include <freerdp/client.h>
#include <freerdp/utils/signal.h>
+#include <freerdp/locale/keyboard.h>
#include <linux/input.h>
diff --git a/client/Wayland/wlfreerdp.h b/client/Wayland/wlfreerdp.h
index f9fe716a8..7605e4685 100644
--- a/client/Wayland/wlfreerdp.h
+++ b/client/Wayland/wlfreerdp.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __WLFREERDP_H
-#define __WLFREERDP_H
+#ifndef FREERDP_CLIENT_WAYLAND_FREERDP_H
+#define FREERDP_CLIENT_WAYLAND_FREERDP_H
#include <freerdp/client/encomsp.h>
#include <freerdp/client/rdpei.h>
@@ -50,5 +50,5 @@ struct wlf_context
EncomspClientContext* encomsp;
};
-#endif /* __WLFREERDP_H */
+#endif /* FREERDP_CLIENT_WAYLAND_FREERDP_H */
diff --git a/client/Windows/cli/wfreerdp.h b/client/Windows/cli/wfreerdp.h
index 913d5d6f5..2bb57bced 100644
--- a/client/Windows/cli/wfreerdp.h
+++ b/client/Windows/cli/wfreerdp.h
@@ -19,9 +19,9 @@
* limitations under the License.
*/
-#ifndef __WFREERDP_H
-#define __WFREERDP_H
+#ifndef FREERDP_CLIENT_WIN_FREERDP_H
+#define FREERDP_CLIENT_WIN_FREERDP_H
#include "wf_interface.h"
-#endif
+#endif /* FREERDP_CLIENT_WIN_FREERDP_H */
diff --git a/client/Windows/wf_channels.h b/client/Windows/wf_channels.h
index 97ac2bb88..d80f24342 100644
--- a/client/Windows/wf_channels.h
+++ b/client/Windows/wf_channels.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef __WF_CHANNELS_H
-#define __WF_CHANNELS_H
+#ifndef FREERDP_CLIENT_WIN_CHANNELS_H
+#define FREERDP_CLIENT_WIN_CHANNELS_H
#include <freerdp/freerdp.h>
#include <freerdp/client/channels.h>
@@ -33,4 +33,4 @@ void wf_OnChannelConnectedEventHandler(rdpContext* context,
void wf_OnChannelDisconnectedEventHandler(rdpContext* context,
ChannelDisconnectedEventArgs* e);
-#endif
+#endif /* FREERDP_CLIENT_WIN_CHANNELS_H */
diff --git a/client/Windows/wf_client.h b/client/Windows/wf_client.h
index 1e4ac620b..708c1c10b 100644
--- a/client/Windows/wf_client.h
+++ b/client/Windows/wf_client.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __WF_INTERFACE_H
-#define __WF_INTERFACE_H
+#ifndef FREERDP_CLIENT_WIN_INTERFACE_H
+#define FREERDP_CLIENT_WIN_INTERFACE_H
#include <winpr/windows.h>
@@ -148,4 +148,4 @@ FREERDP_API void wf_size_scrollbars(wfContext* wfc, UINT32 client_width,
}
#endif
-#endif
+#endif /* FREERDP_CLIENT_WIN_INTERFACE_H */
diff --git a/client/Windows/wf_cliprdr.c b/client/Windows/wf_cliprdr.c
index 0f158de88..fd075f6b1 100644
--- a/client/Windows/wf_cliprdr.c
+++ b/client/Windows/wf_cliprdr.c
@@ -2508,8 +2508,8 @@ BOOL wf_cliprdr_init(wfContext* wfc, CliprdrClientContext* cliprdr)
&& clipboard->GetUpdatedClipboardFormats))
clipboard->legacyApi = TRUE;
- if (!(clipboard->format_mappings = (formatMapping*) calloc(1,
- sizeof(formatMapping) * clipboard->map_capacity)))
+ if (!(clipboard->format_mappings = (formatMapping*) calloc(clipboard->map_capacity,
+ sizeof(formatMapping))))
goto error;
if (!(clipboard->response_data_event = CreateEvent(NULL, TRUE, FALSE,
diff --git a/client/Windows/wf_cliprdr.h b/client/Windows/wf_cliprdr.h
index 69cd052b9..3a6b4a186 100644
--- a/client/Windows/wf_cliprdr.h
+++ b/client/Windows/wf_cliprdr.h
@@ -16,12 +16,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __WF_CLIPRDR_H
-#define __WF_CLIPRDR_H
+#ifndef FREERDP_CLIENT_WIN_CLIPRDR_H
+#define FREERDP_CLIENT_WIN_CLIPRDR_H
#include "wf_client.h"
BOOL wf_cliprdr_init(wfContext* wfc, CliprdrClientContext* cliprdr);
BOOL wf_cliprdr_uninit(wfContext* wfc, CliprdrClientContext* cliprdr);
-#endif /* __WF_CLIPRDR_H */
+#endif /* FREERDP_CLIENT_WIN_CLIPRDR_H */
diff --git a/client/Windows/wf_event.h b/client/Windows/wf_event.h
index d7e4a55d3..a9d710851 100644
--- a/client/Windows/wf_event.h
+++ b/client/Windows/wf_event.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __WF_EVENT_H
-#define __WF_EVENT_H
+#ifndef FREERDP_CLIENT_WIN_EVENT_H
+#define FREERDP_CLIENT_WIN_EVENT_H
#include "wf_client.h"
#include <freerdp/log.h>
@@ -38,4 +38,4 @@ void wf_event_focus_in(wfContext* wfc);
#define DEBUG_KBD(...) do { } while (0)
#endif
-#endif /* __WF_EVENT_H */
+#endif /* FREERDP_CLIENT_WIN_EVENT_H */
diff --git a/client/Windows/wf_floatbar.h b/client/Windows/wf_floatbar.h
index 7b6f67dd0..9867e9d5f 100644
--- a/client/Windows/wf_floatbar.h
+++ b/client/Windows/wf_floatbar.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __WF_FLOATBAR_H__
-#define __WF_FLOATBAR_H__
+#ifndef FREERDP_CLIENT_WIN_FLOATBAR_H
+#define FREERDP_CLIENT_WIN_FLOATBAR_H
typedef struct _FloatBar FloatBar;
typedef struct wf_context wfContext;
@@ -27,4 +27,4 @@ void floatbar_window_create(wfContext* wfc);
int floatbar_show(FloatBar* floatbar);
int floatbar_hide(FloatBar* floatbar);
-#endif
+#endif /* FREERDP_CLIENT_WIN_FLOATBAR_H */
diff --git a/client/Windows/wf_gdi.h b/client/Windows/wf_gdi.h
index 23b5ec41f..3ceec490f 100644
--- a/client/Windows/wf_gdi.h
+++ b/client/Windows/wf_gdi.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __WF_GDI_H
-#define __WF_GDI_H
+#ifndef FREERDP_CLIENT_WIN_GDI_H
+#define FREERDP_CLIENT_WIN_GDI_H
#include "wf_client.h"
@@ -37,4 +37,4 @@ void wf_gdi_register_update_callbacks(rdpUpdate* update);
void wf_update_canvas_diff(wfContext* wfc);
-#endif /* __WF_GDI_H */
+#endif /* FREERDP_CLIENT_WIN_GDI_H */
diff --git a/client/Windows/wf_graphics.h b/client/Windows/wf_graphics.h
index 14508081a..da2e36eff 100644
--- a/client/Windows/wf_graphics.h
+++ b/client/Windows/wf_graphics.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __WF_GRAPHICS_H
-#define __WF_GRAPHICS_H
+#ifndef FREERDP_CLIENT_WIN_GRAPHICS_H
+#define FREERDP_CLIENT_WIN_GRAPHICS_H
#include "wf_client.h"
@@ -31,4 +31,4 @@ void wf_image_free(wfBitmap* image);
BOOL wf_register_pointer(rdpGraphics* graphics);
BOOL wf_register_graphics(rdpGraphics* graphics);
-#endif /* WF_GRAPHICS */
+#endif /* FREERDP_CLIENT_WIN_GRAPHICS_H */
diff --git a/client/Windows/wf_rail.h b/client/Windows/wf_rail.h
index 4fbeb74f5..1bf8c27a6 100644
--- a/client/Windows/wf_rail.h
+++ b/client/Windows/wf_rail.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef __WF_RAIL_H
-#define __WF_RAIL_H
+#ifndef FREERDP_CLIENT_WIN_RAIL_H
+#define FREERDP_CLIENT_WIN_RAIL_H
typedef struct wf_rail_window wfRailWindow;
@@ -46,4 +46,4 @@ void wf_rail_uninit(wfContext* wfc, RailClientContext* rail);
void wf_rail_invalidate_region(wfContext* wfc, REGION16* invalidRegion);
-#endif
+#endif /* FREERDP_CLIENT_WIN_RAIL_H */
diff --git a/client/X11/xf_channels.h b/client/X11/xf_channels.h
index 1be37c4d0..441ca99f6 100644
--- a/client/X11/xf_channels.h
+++ b/client/X11/xf_channels.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_CHANNELS_H
-#define __XF_CHANNELS_H
+#ifndef FREERDP_CLIENT_X11_CHANNELS_H
+#define FREERDP_CLIENT_X11_CHANNELS_H
#include <freerdp/freerdp.h>
#include <freerdp/client/channels.h>
@@ -35,4 +35,4 @@ int xf_on_channel_disconnected(freerdp* instance, const char* name, void* pInter
void xf_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e);
void xf_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnectedEventArgs* e);
-#endif
+#endif /* FREERDP_CLIENT_X11_CHANNELS_H */
diff --git a/client/X11/xf_client.h b/client/X11/xf_client.h
index 1ac55e8cf..34535a1e1 100644
--- a/client/X11/xf_client.h
+++ b/client/X11/xf_client.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_CLIENT_H
-#define __XF_CLIENT_H
+#ifndef FREERDP_CLIENT_X11_CLIENT_H
+#define FREERDP_CLIENT_X11_CLIENT_H
#include <winpr/crt.h>
#include <winpr/synch.h>
@@ -50,4 +50,4 @@ FREERDP_API int RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
}
#endif
-#endif /* __XF_CLIENT_H */
+#endif /* FREERDP_CLIENT_X11_CLIENT_H */
diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c
index e87607ec9..e47138591 100644
--- a/client/X11/xf_cliprdr.c
+++ b/client/X11/xf_cliprdr.c
@@ -1603,8 +1603,7 @@ static UINT xf_cliprdr_clipboard_file_range_failure(wClipboardDelegate* delegate
xfClipboard* xf_clipboard_new(xfContext* xfc)
{
- int i;
- int n;
+ int i, n = 0;
rdpChannels* channels;
xfClipboard* clipboard;
@@ -1664,8 +1663,6 @@ xfClipboard* xf_clipboard_new(xfContext* xfc)
"Warning: Using clipboard redirection without XFIXES extension is strongly discouraged!");
#endif
- n = 0;
-
clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "_FREERDP_RAW", False);
clipboard->clientFormats[n].formatId = CF_RAW;
n++;
diff --git a/client/X11/xf_cliprdr.h b/client/X11/xf_cliprdr.h
index 7175b3a54..f9c3583da 100644
--- a/client/X11/xf_cliprdr.h
+++ b/client/X11/xf_cliprdr.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_CLIPRDR_H
-#define __XF_CLIPRDR_H
+#ifndef FREERDP_CLIENT_X11_CLIPRDR_H
+#define FREERDP_CLIENT_X11_CLIPRDR_H
#include "xf_client.h"
#include "xfreerdp.h"
@@ -33,4 +33,4 @@ void xf_cliprdr_uninit(xfContext* xfc, CliprdrClientContext* cliprdr);
void xf_cliprdr_handle_xevent(xfContext* xfc, XEvent* event);
-#endif /* __XF_CLIPRDR_H */
+#endif /* FREERDP_CLIENT_X11_CLIPRDR_H */
diff --git a/client/X11/xf_event.h b/client/X11/xf_event.h
index 8477b69b2..4e880aa03 100644
--- a/client/X11/xf_event.h
+++ b/client/X11/xf_event.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_EVENT_H
-#define __XF_EVENT_H
+#ifndef FREERDP_CLIENT_X11_EVENT_H
+#define FREERDP_CLIENT_X11_EVENT_H
#include "xf_keyboard.h"
@@ -37,4 +37,4 @@ BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state, Window win
BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window window, BOOL app);
BOOL xf_generic_ButtonRelease(xfContext* xfc, int x, int y, int button, Window window, BOOL app);
-#endif /* __XF_EVENT_H */
+#endif /* FREERDP_CLIENT_X11_EVENT_H */
diff --git a/client/X11/xf_gdi.c b/client/X11/xf_gdi.c
index a0f2a4cb6..57a3e5310 100644
--- a/client/X11/xf_gdi.c
+++ b/client/X11/xf_gdi.c
@@ -580,7 +580,7 @@ static BOOL xf_gdi_polyline(rdpContext* context,
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetForeground(xfc->display, xfc->gc, color.pixel);
npoints = polyline->numDeltaEntries + 1;
- points = malloc(sizeof(XPoint) * npoints);
+ points = calloc(npoints, sizeof(XPoint));
if (!points)
{
@@ -743,7 +743,7 @@ static BOOL xf_gdi_polygon_sc(rdpContext* context,
xf_lock_x11(xfc, FALSE);
xf_set_rop2(xfc, polygon_sc->bRop2);
npoints = polygon_sc->numPoints + 1;
- points = malloc(sizeof(XPoint) * npoints);
+ points = calloc(npoints, sizeof(XPoint));
if (!points)
{
@@ -814,7 +814,7 @@ static BOOL xf_gdi_polygon_cb(rdpContext* context,
brush = &(polygon_cb->brush);
xf_set_rop2(xfc, polygon_cb->bRop2);
npoints = polygon_cb->numPoints + 1;
- points = malloc(sizeof(XPoint) * npoints);
+ points = calloc(npoints, sizeof(XPoint));
if (!points)
{
diff --git a/client/X11/xf_gdi.h b/client/X11/xf_gdi.h
index f11bd0bca..84dcfc447 100644
--- a/client/X11/xf_gdi.h
+++ b/client/X11/xf_gdi.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __XF_GDI_H
-#define __XF_GDI_H
+#ifndef FREERDP_CLIENT_X11_GDI_H
+#define FREERDP_CLIENT_X11_GDI_H
#include <freerdp/gdi/gdi.h>
@@ -29,4 +29,4 @@
void xf_gdi_register_update_callbacks(rdpUpdate* update);
-#endif /* __XF_GDI_H */
+#endif /* FREERDP_CLIENT_X11_GDI_H */
diff --git a/client/X11/xf_gfx.h b/client/X11/xf_gfx.h
index df0c8e21a..11c172004 100644
--- a/client/X11/xf_gfx.h
+++ b/client/X11/xf_gfx.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __XF_GRAPHICS_PIPELINE_H
-#define __XF_GRAPHICS_PIPELINE_H
+#ifndef FREERDP_CLIENT_X11_GFX_H
+#define FREERDP_CLIENT_X11_GFX_H
#include "xf_client.h"
#include "xfreerdp.h"
@@ -53,4 +53,4 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y,
void xf_graphics_pipeline_init(xfContext* xfc, RdpgfxClientContext* gfx);
void xf_graphics_pipeline_uninit(xfContext* xfc, RdpgfxClientContext* gfx);
-#endif /* __XF_GRAPHICS_PIPELINE_H */
+#endif /* FREERDP_CLIENT_X11_GFX_H */
diff --git a/client/X11/xf_graphics.h b/client/X11/xf_graphics.h
index d185baace..303e116c1 100644
--- a/client/X11/xf_graphics.h
+++ b/client/X11/xf_graphics.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_GRAPHICS_H
-#define __XF_GRAPHICS_H
+#ifndef FREERDP_CLIENT_X11_GRAPHICS_H
+#define FREERDP_CLIENT_X11_GRAPHICS_H
#include "xf_client.h"
#include "xfreerdp.h"
@@ -29,4 +29,4 @@ BOOL xf_register_graphics(rdpGraphics* graphics);
BOOL xf_decode_color(xfContext* xfc, const UINT32 srcColor, XColor* color);
UINT32 xf_get_local_color_format(xfContext* xfc, BOOL aligned);
-#endif /* __XF_GRAPHICS_H */
+#endif /* FREERDP_CLIENT_X11_GRAPHICS_H */
diff --git a/client/X11/xf_input.h b/client/X11/xf_input.h
index 6289fdb74..c08fea092 100644
--- a/client/X11/xf_input.h
+++ b/client/X11/xf_input.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_INPUT_H
-#define __XF_INPUT_H
+#ifndef FREERDP_CLIENT_X11_INPUT_H
+#define FREERDP_CLIENT_X11_INPUT_H
#include "xf_client.h"
#include "xfreerdp.h"
@@ -30,4 +30,4 @@
int xf_input_init(xfContext* xfc, Window window);
int xf_input_handle_event(xfContext* xfc, XEvent* event);
-#endif
+#endif /* FREERDP_CLIENT_X11_INPUT_H */
diff --git a/client/X11/xf_keyboard.h b/client/X11/xf_keyboard.h
index cdd2d2162..c7e601b1b 100644
--- a/client/X11/xf_keyboard.h
+++ b/client/X11/xf_keyboard.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef XF_KEYBOARD_H
-#define XF_KEYBOARD_H
+#ifndef FREERDP_CLIENT_X11_XF_KEYBOARD_H
+#define FREERDP_CLIENT_X11_XF_KEYBOARD_H
#include <freerdp/locale/keyboard.h>
@@ -59,4 +59,4 @@ void xf_keyboard_handle_special_keys_release(xfContext* xfc, KeySym keysym);
BOOL xf_keyboard_set_indicators(rdpContext* context, UINT16 led_flags);
BOOL xf_keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32 imeState, UINT32 imeConvMode);
-#endif /* __XF_KEYBOARD_H */
+#endif /* FREERDP_CLIENT_X11_XF_KEYBOARD_H */
diff --git a/client/X11/xf_monitor.h b/client/X11/xf_monitor.h
index 8e15a3abe..2e3cd2f34 100644
--- a/client/X11/xf_monitor.h
+++ b/client/X11/xf_monitor.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_MONITOR_H
-#define __XF_MONITOR_H
+#ifndef FREERDP_CLIENT_X11_MONITOR_H
+#define FREERDP_CLIENT_X11_MONITOR_H
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
@@ -47,4 +47,4 @@ FREERDP_API int xf_list_monitors(xfContext* xfc);
FREERDP_API BOOL xf_detect_monitors(xfContext* xfc, UINT32* pWidth, UINT32* pHeight);
FREERDP_API void xf_monitors_free(xfContext* xfc);
-#endif /* __XF_MONITOR_H */
+#endif /* FREERDP_CLIENT_X11_MONITOR_H */
diff --git a/client/X11/xf_rail.h b/client/X11/xf_rail.h
index d7a47ea01..2e1ea539c 100644
--- a/client/X11/xf_rail.h
+++ b/client/X11/xf_rail.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_RAIL_H
-#define __XF_RAIL_H
+#ifndef FREERDP_CLIENT_X11_RAIL_H
+#define FREERDP_CLIENT_X11_RAIL_H
#include "xf_client.h"
#include "xfreerdp.h"
@@ -36,4 +36,4 @@ void xf_rail_disable_remoteapp_mode(xfContext* xfc);
int xf_rail_init(xfContext* xfc, RailClientContext* rail);
int xf_rail_uninit(xfContext* xfc, RailClientContext* rail);
-#endif /* __XF_RAIL_H */
+#endif /* FREERDP_CLIENT_X11_RAIL_H */
diff --git a/client/X11/xf_tsmf.h b/client/X11/xf_tsmf.h
index 0469d6860..63a973aa7 100644
--- a/client/X11/xf_tsmf.h
+++ b/client/X11/xf_tsmf.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_TSMF_H
-#define __XF_TSMF_H
+#ifndef FREERDP_CLIENT_X11_TSMF_H
+#define FREERDP_CLIENT_X11_TSMF_H
#include "xf_client.h"
#include "xfreerdp.h"
@@ -26,4 +26,4 @@
int xf_tsmf_init(xfContext* xfc, TsmfClientContext* tsmf);
int xf_tsmf_uninit(xfContext* xfc, TsmfClientContext* tsmf);
-#endif /* __XF_TSMF_H */
+#endif /* FREERDP_CLIENT_X11_TSMF_H */
diff --git a/client/X11/xf_window.h b/client/X11/xf_window.h
index 37c92aef3..44921cc99 100644
--- a/client/X11/xf_window.h
+++ b/client/X11/xf_window.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __XF_WINDOW_H
-#define __XF_WINDOW_H
+#ifndef FREERDP_CLIENT_X11_WINDOW_H
+#define FREERDP_CLIENT_X11_WINDOW_H
#include <X11/Xlib.h>
@@ -174,4 +174,4 @@ void xf_StartLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow, int direction
void xf_EndLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow);
xfAppWindow* xf_AppWindowFromX11Window(xfContext* xfc, Window wnd);
-#endif /* __XF_WINDOW_H */
+#endif /* FREERDP_CLIENT_X11_WINDOW_H */
diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h
index 12b142d02..8cfcb246b 100644
--- a/client/X11/xfreerdp.h
+++ b/client/X11/xfreerdp.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __XFREERDP_H
-#define __XFREERDP_H
+#ifndef FREERDP_CLIENT_X11_FREERDP_H
+#define FREERDP_CLIENT_X11_FREERDP_H
typedef struct xf_context xfContext;
@@ -287,5 +287,5 @@ void xf_draw_screen(xfContext* xfc, int x, int y, int w, int h);
FREERDP_API DWORD xf_exit_code_from_disconnect_reason(DWORD reason);
-#endif /* __XFREERDP_H */
+#endif /* FREERDP_CLIENT_X11_FREERDP_H */
diff --git a/client/common/compatibility.h b/client/common/compatibility.h
index 358587c93..1a5d3e061 100644
--- a/client/common/compatibility.h
+++ b/client/common/compatibility.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CLIENT_COMPATIBILITY_H
-#define FREERDP_CLIENT_COMPATIBILITY_H
+#ifndef FREERDP_CLIENT_COMMON_COMPATIBILITY_H
+#define FREERDP_CLIENT_COMMON_COMPATIBILITY_H
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
@@ -26,5 +26,5 @@
FREERDP_API int freerdp_detect_old_command_line_syntax(int argc, char** argv, int* count);
FREERDP_API int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSettings* settings);
-#endif /* FREERDP_CLIENT_COMPATIBILITY */
+#endif /* FREERDP_CLIENT_COMMON_COMPATIBILITY_H */
diff --git a/client/common/file.c b/client/common/file.c
index ea3c50455..ca1b9b71b 100644
--- a/client/common/file.c
+++ b/client/common/file.c
@@ -814,7 +814,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
return FALSE;
}
- buffer = (char*) malloc((length + 1) * sizeof(char));
+ buffer = (char*) calloc((length + 1), sizeof(char));
if (freerdp_client_write_rdp_file_buffer(file, buffer, length + 1) != length)
{
@@ -1427,7 +1427,7 @@ rdpFile* freerdp_client_rdp_file_new()
FillMemory(file, sizeof(rdpFile), 0xFF);
file->lineCount = 0;
file->lineSize = 32;
- file->lines = (rdpFileLine*) malloc(file->lineSize * sizeof(rdpFileLine));
+ file->lines = (rdpFileLine*) calloc(file->lineSize, sizeof(rdpFileLine));
if (!file->lines)
{
@@ -1437,7 +1437,7 @@ rdpFile* freerdp_client_rdp_file_new()
file->argc = 0;
file->argSize = 32;
- file->argv = (char**) malloc(file->argSize * sizeof(char*));
+ file->argv = (char**) calloc(file->argSize, sizeof(char*));
if (!file->argv)
{
diff --git a/config.h.in b/config.h.in
index 4e97ee121..b634b53ca 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,5 +1,5 @@
-#ifndef __CONFIG_H
-#define __CONFIG_H
+#ifndef FREERDP_CONFIG_H
+#define FREERDP_CONFIG_H
/* Include files */
#cmakedefine HAVE_FCNTL_H
@@ -90,4 +90,4 @@
#cmakedefine WITH_DEBUG_X11_LOCAL_MOVESIZE
#cmakedefine WITH_DEBUG_XV
#cmakedefine WITH_DEBUG_RINGBUFFER
-#endif
+#endif /* FREERDP_CONFIG_H */
diff --git a/include/freerdp/channels/rdpei.h b/include/freerdp/channels/rdpei.h
index ac76bf364..375fa6099 100644
--- a/include/freerdp/channels/rdpei.h
+++ b/include/freerdp/channels/rdpei.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __FREERDP_CHANNEL_RDPEI_H_
-#define __FREERDP_CHANNEL_RDPEI_H_
+#ifndef FREERDP_CHANNEL_RDPEI_H
+#define FREERDP_CHANNEL_RDPEI_H
#include <winpr/wtypes.h>
@@ -87,5 +87,5 @@ struct _RDPINPUT_TOUCH_EVENT
typedef struct _RDPINPUT_TOUCH_EVENT RDPINPUT_TOUCH_EVENT;
-#endif /* __FREERDP_CHANNEL_RDPEI_H_ */
+#endif /* FREERDP_CHANNEL_RDPEI_H */
diff --git a/include/freerdp/client/audin.h b/include/freerdp/client/audin.h
index 56a7f0046..e78e4b1ea 100644
--- a/include/freerdp/client/audin.h
+++ b/include/freerdp/client/audin.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_AUDIN_H
-#define FREERDP_CHANNEL_CLIENT_AUDIN_H
+#ifndef FREERDP_CHANNEL_AUDIN_CLIENT_AUDIN_H
+#define FREERDP_CHANNEL_AUDIN_CLIENT_AUDIN_H
#include <freerdp/channels/audin.h>
#include <freerdp/freerdp.h>
@@ -69,5 +69,5 @@ typedef FREERDP_AUDIN_DEVICE_ENTRY_POINTS* PFREERDP_AUDIN_DEVICE_ENTRY_POINTS;
typedef UINT (*PFREERDP_AUDIN_DEVICE_ENTRY)(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints);
-#endif /* FREERDP_CHANNEL_CLIENT_AUDIN_H */
+#endif /* FREERDP_CHANNEL_AUDIN_CLIENT_AUDIN_H */
diff --git a/include/freerdp/client/channels.h b/include/freerdp/client/channels.h
index 4e71fcc89..336ba5327 100644
--- a/include/freerdp/client/channels.h
+++ b/include/freerdp/client/channels.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNELS_CLIENT
-#define FREERDP_CHANNELS_CLIENT
+#ifndef FREERDP_CHANNELS_CLIENT_H
+#define FREERDP_CHANNELS_CLIENT_H
#include <freerdp/api.h>
#include <freerdp/addin.h>
@@ -38,5 +38,5 @@ FREERDP_API void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins);
}
#endif
-#endif /* FREERDP_CHANNELS_CLIENT */
+#endif /* FREERDP_CHANNELS_CLIENT_H */
diff --git a/include/freerdp/client/cliprdr.h b/include/freerdp/client/cliprdr.h
index cb4b69cdf..3fe40823a 100644
--- a/include/freerdp/client/cliprdr.h
+++ b/include/freerdp/client/cliprdr.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_CLIPRDR_H
-#define FREERDP_CHANNEL_CLIENT_CLIPRDR_H
+#ifndef FREERDP_CHANNEL_CLIPRDR_CLIENT_CLIPRDR_H
+#define FREERDP_CHANNEL_CLIPRDR_CLIENT_CLIPRDR_H
#include <freerdp/types.h>
@@ -180,4 +180,4 @@ struct _RDP_CB_TEMPDIR_EVENT
};
typedef struct _RDP_CB_TEMPDIR_EVENT RDP_CB_TEMPDIR_EVENT;
-#endif /* FREERDP_CHANNEL_CLIENT_CLIPRDR_H */
+#endif /* FREERDP_CHANNEL_CLIPRDR_CLIENT_CLIPRDR_H */
diff --git a/include/freerdp/client/disp.h b/include/freerdp/client/disp.h
index be21164ed..d61644cab 100644
--- a/include/freerdp/client/disp.h
+++ b/include/freerdp/client/disp.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_DISP_H
-#define FREERDP_CHANNEL_CLIENT_DISP_H
+#ifndef FREERDP_CHANNEL_DISP_CLIENT_DISP_H
+#define FREERDP_CHANNEL_DISP_CLIENT_DISP_H
#define ORIENTATION_LANDSCAPE 0
#define ORIENTATION_PORTRAIT 90
@@ -62,5 +62,5 @@ struct _disp_client_context
pcDispSendMonitorLayout SendMonitorLayout;
};
-#endif /* FREERDP_CHANNEL_CLIENT_DISP_H */
+#endif /* FREERDP_CHANNEL_DISP_CLIENT_DISP_H */
diff --git a/include/freerdp/client/drdynvc.h b/include/freerdp/client/drdynvc.h
index 1bccd6462..332927cc4 100644
--- a/include/freerdp/client/drdynvc.h
+++ b/include/freerdp/client/drdynvc.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_DRDYNVC_H
-#define FREERDP_CHANNEL_CLIENT_DRDYNVC_H
+#ifndef FREERDP_CHANNEL_DRDYNVC_CLIENT_DRDYNVC_H
+#define FREERDP_CHANNEL_DRDYNVC_CLIENT_DRDYNVC_H
/**
* Client Interface
@@ -50,4 +50,4 @@ struct _drdynvc_client_context
pcDrdynvcOnChannelDetached OnChannelDetached;
};
-#endif /* FREERDP_CHANNEL_CLIENT_DRDYNVC_H */
+#endif /* FREERDP_CHANNEL_DRDYNVC_CLIENT_DRDYNVC_H */
diff --git a/include/freerdp/client/encomsp.h b/include/freerdp/client/encomsp.h
index 3be18cd74..0ac5a2d62 100644
--- a/include/freerdp/client/encomsp.h
+++ b/include/freerdp/client/encomsp.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_ENCOMSP_H
-#define FREERDP_CHANNEL_CLIENT_ENCOMSP_H
+#ifndef FREERDP_CHANNEL_ENCOMSP_CLIENT_ENCOMSP_H
+#define FREERDP_CHANNEL_ENCOMSP_CLIENT_ENCOMSP_H
#include <freerdp/channels/encomsp.h>
@@ -60,4 +60,4 @@ struct _encomsp_client_context
pcEncomspGraphicsStreamResumed GraphicsStreamResumed;
};
-#endif /* FREERDP_CHANNEL_CLIENT_ENCOMSP_H */
+#endif /* FREERDP_CHANNEL_ENCOMSP_CLIENT_ENCOMSP_H */
diff --git a/include/freerdp/client/rail.h b/include/freerdp/client/rail.h
index f492f5f51..2284face0 100644
--- a/include/freerdp/client/rail.h
+++ b/include/freerdp/client/rail.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_RAIL_H
-#define FREERDP_CHANNEL_CLIENT_RAIL_H
+#ifndef FREERDP_CHANNEL_RAIL_CLIENT_RAIL_H
+#define FREERDP_CHANNEL_RAIL_CLIENT_RAIL_H
#include <freerdp/api.h>
#include <freerdp/types.h>
@@ -83,5 +83,5 @@ struct _rail_client_context
pcRailServerGetAppIdResponse ServerGetAppIdResponse;
};
-#endif /* FREERDP_CHANNEL_CLIENT_RAIL_H */
+#endif /* FREERDP_CHANNEL_RAIL_CLIENT_RAIL_H */
diff --git a/include/freerdp/client/rdpei.h b/include/freerdp/client/rdpei.h
index 30a011f24..3b8e961a7 100644
--- a/include/freerdp/client/rdpei.h
+++ b/include/freerdp/client/rdpei.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_RDPEI_H
-#define FREERDP_CHANNEL_CLIENT_RDPEI_H
+#ifndef FREERDP_CHANNEL_RDPEI_CLIENT_RDPEI_H
+#define FREERDP_CHANNEL_RDPEI_CLIENT_RDPEI_H
#include <freerdp/channels/rdpei.h>
@@ -57,4 +57,4 @@ struct _rdpei_client_context
pcRdpeiResumeTouch ResumeTouch;
};
-#endif /* FREERDP_CHANNEL_CLIENT_RDPEI_H */
+#endif /* FREERDP_CHANNEL_RDPEI_CLIENT_RDPEI_H */
diff --git a/include/freerdp/client/rdpgfx.h b/include/freerdp/client/rdpgfx.h
index 333f30ec4..50b191452 100644
--- a/include/freerdp/client/rdpgfx.h
+++ b/include/freerdp/client/rdpgfx.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_RDPGFX_H
-#define FREERDP_CHANNEL_CLIENT_RDPGFX_H
+#ifndef FREERDP_CHANNEL_RDPGFX_CLIENT_RDPGFX_H
+#define FREERDP_CHANNEL_RDPGFX_CLIENT_RDPGFX_H
#include <freerdp/channels/rdpgfx.h>
#include <freerdp/utils/profiler.h>
@@ -114,4 +114,4 @@ struct _rdpgfx_client_context
PROFILER_DEFINE(SurfaceProfiler);
};
-#endif /* FREERDP_CHANNEL_CLIENT_RDPGFX_H */
+#endif /* FREERDP_CHANNEL_RDPGFX_CLIENT_RDPGFX_H */
diff --git a/include/freerdp/client/rdpsnd.h b/include/freerdp/client/rdpsnd.h
index 6f4ba8b61..089046cd2 100644
--- a/include/freerdp/client/rdpsnd.h
+++ b/include/freerdp/client/rdpsnd.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_RDPSND_H
-#define FREERDP_CHANNEL_CLIENT_RDPSND_H
+#ifndef FREERDP_CHANNEL_RDPSND_CLIENT_RDPSND_H
+#define FREERDP_CHANNEL_RDPSND_CLIENT_RDPSND_H
#include <freerdp/channels/rdpsnd.h>
@@ -100,5 +100,5 @@ typedef FREERDP_RDPSND_DEVICE_ENTRY_POINTS* PFREERDP_RDPSND_DEVICE_ENTRY_POINTS;
typedef UINT (*PFREERDP_RDPSND_DEVICE_ENTRY)(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints);
-#endif /* FREERDP_CHANNEL_CLIENT_RDPSND_H */
+#endif /* FREERDP_CHANNEL_RDPSND_CLIENT_RDPSND_H */
diff --git a/include/freerdp/client/remdesk.h b/include/freerdp/client/remdesk.h
index 600a421ce..dae72f8de 100644
--- a/include/freerdp/client/remdesk.h
+++ b/include/freerdp/client/remdesk.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_REMDESK_H
-#define FREERDP_CHANNEL_CLIENT_REMDESK_H
+#ifndef FREERDP_CHANNEL_REMDESK_CLIENT_REMDESK_H
+#define FREERDP_CHANNEL_REMDESK_CLIENT_REMDESK_H
#include <freerdp/channels/remdesk.h>
@@ -34,5 +34,5 @@ struct _remdesk_client_context
void* custom;
};
-#endif /* FREERDP_CHANNEL_CLIENT_REMDESK_H */
+#endif /* FREERDP_CHANNEL_REMDESK_CLIENT_REMDESK_H */
diff --git a/include/freerdp/client/tsmf.h b/include/freerdp/client/tsmf.h
index 674a9c737..3730716ef 100644
--- a/include/freerdp/client/tsmf.h
+++ b/include/freerdp/client/tsmf.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_CLIENT_TSMF_H
-#define FREERDP_CHANNEL_CLIENT_TSMF_H
+#ifndef FREERDP_CHANNEL_TSMF_CLIENT_TSMF_H
+#define FREERDP_CHANNEL_TSMF_CLIENT_TSMF_H
#include <freerdp/codec/region.h>
@@ -61,4 +61,4 @@ struct _tsmf_client_context
pcTsmfFrameEvent FrameEvent;
};
-#endif /* FREERDP_CHANNEL_CLIENT_TSMF_H */
+#endif /* FREERDP_CHANNEL_TSMF_CLIENT_TSMF_H */
diff --git a/include/freerdp/codec/region.h b/include/freerdp/codec/region.h
index 5a6493505..c66705241 100644
--- a/include/freerdp/codec/region.h
+++ b/include/freerdp/codec/region.h
@@ -21,8 +21,8 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef __REGION_H___
-#define __REGION_H___
+#ifndef FREERDP_CODEC_REGION_H
+#define FREERDP_CODEC_REGION_H
#include <freerdp/api.h>
#include <freerdp/types.h>
@@ -153,4 +153,4 @@ FREERDP_API void region16_uninit(REGION16* region);
}
#endif
-#endif /* __REGION_H___ */
+#endif /* FREERDP_CODEC_REGION_H */
diff --git a/include/freerdp/primitives.h b/include/freerdp/primitives.h
index 14cdeeb5e..022da27b7 100644
--- a/include/freerdp/primitives.h
+++ b/include/freerdp/primitives.h
@@ -17,8 +17,8 @@
# pragma once
#endif
-#ifndef __PRIMITIVES_H_INCLUDED__
-#define __PRIMITIVES_H_INCLUDED__
+#ifndef FREERDP_PRIMITIVES_H
+#define FREERDP_PRIMITIVES_H
#include <freerdp/api.h>
#include <freerdp/types.h>
@@ -267,4 +267,4 @@ FREERDP_API primitives_t* primitives_get_generic(void);
}
#endif
-#endif /* !__PRIMITIVES_H_INCLUDED__ */
+#endif /* FREERDP_PRIMITIVES_H */
diff --git a/include/freerdp/server/channels.h b/include/freerdp/server/channels.h
index cd14831fa..b2bcb3696 100644
--- a/include/freerdp/server/channels.h
+++ b/include/freerdp/server/channels.h
@@ -17,10 +17,10 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNELS_SERVER
-#define FREERDP_CHANNELS_SERVER
+#ifndef FREERDP_CHANNELS_SERVER_H
+#define FREERDP_CHANNELS_SERVER_H
#include <freerdp/api.h>
-#endif /* FREERDP_CHANNELS_SERVER */
+#endif /* FREERDP_CHANNELS_SERVER_H */
diff --git a/include/freerdp/server/cliprdr.h b/include/freerdp/server/cliprdr.h
index 221d837b3..fe4bc2757 100644
--- a/include/freerdp/server/cliprdr.h
+++ b/include/freerdp/server/cliprdr.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_CLIPRDR_H
-#define FREERDP_CHANNEL_SERVER_CLIPRDR_H
+#ifndef FREERDP_CHANNEL_CLIPRDR_SERVER_CLIPRDR_H
+#define FREERDP_CHANNEL_CLIPRDR_SERVER_CLIPRDR_H
#include <freerdp/api.h>
#include <freerdp/types.h>
@@ -116,4 +116,4 @@ FREERDP_API void cliprdr_server_context_free(CliprdrServerContext* context);
}
#endif
-#endif /* FREERDP_CHANNEL_SERVER_CLIPRDR_H */
+#endif /* FREERDP_CHANNEL_CLIPRDR_SERVER_CLIPRDR_H */
diff --git a/include/freerdp/server/drdynvc.h b/include/freerdp/server/drdynvc.h
index dd50cd27f..2b355c488 100644
--- a/include/freerdp/server/drdynvc.h
+++ b/include/freerdp/server/drdynvc.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_DRDYNVC_H
-#define FREERDP_CHANNEL_SERVER_DRDYNVC_H
+#ifndef FREERDP_CHANNEL_DRDYNVC_SERVER_DRDYNVC_H
+#define FREERDP_CHANNEL_DRDYNVC_SERVER_DRDYNVC_H
#include <freerdp/api.h>
#include <freerdp/types.h>
@@ -57,4 +57,4 @@ FREERDP_API void drdynvc_server_context_free(DrdynvcServerContext* context);
}
#endif
-#endif /* FREERDP_CHANNEL_SERVER_DRDYNVC_H */
+#endif /* FREERDP_CHANNEL_DRDYNVC_SERVER_DRDYNVC_H */
diff --git a/include/freerdp/server/encomsp.h b/include/freerdp/server/encomsp.h
index f8485a434..111224060 100644
--- a/include/freerdp/server/encomsp.h
+++ b/include/freerdp/server/encomsp.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_ENCOMSP_H
-#define FREERDP_CHANNEL_SERVER_ENCOMSP_H
+#ifndef FREERDP_CHANNEL_ENCOMSP_SERVER_ENCOMSP_H
+#define FREERDP_CHANNEL_ENCOMSP_SERVER_ENCOMSP_H
#include <freerdp/api.h>
#include <freerdp/types.h>
@@ -86,4 +86,4 @@ FREERDP_API void encomsp_server_context_free(EncomspServerContext* context);
}
#endif
-#endif /* FREERDP_CHANNEL_SERVER_ENCOMSP_H */
+#endif /* FREERDP_CHANNEL_ENCOMSP_SERVER_ENCOMSP_H */
diff --git a/include/freerdp/server/rdpdr.h b/include/freerdp/server/rdpdr.h
index 27c41e4ed..a533f61ae 100644
--- a/include/freerdp/server/rdpdr.h
+++ b/include/freerdp/server/rdpdr.h
@@ -20,8 +20,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_RDPDR_H
-#define FREERDP_CHANNEL_SERVER_RDPDR_H
+#ifndef FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H
+#define FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H
#include <freerdp/api.h>
#include <freerdp/types.h>
@@ -152,4 +152,4 @@ FREERDP_API void rdpdr_server_context_free(RdpdrServerContext* context);
}
#endif
-#endif /* FREERDP_CHANNEL_SERVER_RDPDR_H */
+#endif /* FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H */
diff --git a/include/freerdp/server/rdpei.h b/include/freerdp/server/rdpei.h
index 74af11f36..86db2b4a8 100644
--- a/include/freerdp/server/rdpei.h
+++ b/include/freerdp/server/rdpei.h
@@ -20,8 +20,8 @@
* limitations under the License.
*/
-#ifndef __FREERDP_CHANNEL_RDPEI_SERVER_H__
-#define __FREERDP_CHANNEL_RDPEI_SERVER_H__
+#ifndef FREERDP_CHANNEL_RDPEI_SERVER_H
+#define FREERDP_CHANNEL_RDPEI_SERVER_H
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/rdpei.h>
@@ -69,4 +69,4 @@ FREERDP_API UINT rdpei_server_resume(RdpeiServerContext *context);
-#endif /* __FREERDP_CHANNEL_RDPEI_SERVER_H__ */
+#endif /* FREERDP_CHANNEL_RDPEI_SERVER_H */
diff --git a/include/freerdp/server/rdpgfx.h b/include/freerdp/server/rdpgfx.h
index fad778935..dada58f93 100644
--- a/include/freerdp/server/rdpgfx.h
+++ b/include/freerdp/server/rdpgfx.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_RDPGFX_H
-#define FREERDP_CHANNEL_SERVER_RDPGFX_H
+#ifndef FREERDP_CHANNEL_RDPGFX_SERVER_RDPGFX_H
+#define FREERDP_CHANNEL_RDPGFX_SERVER_RDPGFX_H
#include <freerdp/channels/rdpgfx.h>
@@ -97,4 +97,4 @@ FREERDP_API UINT rdpgfx_server_handle_messages(RdpgfxServerContext* context);
}
#endif
-#endif /* FREERDP_CHANNEL_SERVER_RDPGFX_H */
+#endif /* FREERDP_CHANNEL_RDPGFX_SERVER_RDPGFX_H */
diff --git a/include/freerdp/server/remdesk.h b/include/freerdp/server/remdesk.h
index 181e36690..e8f531d27 100644
--- a/include/freerdp/server/remdesk.h
+++ b/include/freerdp/server/remdesk.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CHANNEL_SERVER_REMDESK_H
-#define FREERDP_CHANNEL_SERVER_REMDESK_H
+#ifndef FREERDP_CHANNEL_REMDESK_SERVER_REMDESK_H
+#define FREERDP_CHANNEL_REMDESK_SERVER_REMDESK_H
#include <freerdp/api.h>
#include <freerdp/types.h>
@@ -61,5 +61,5 @@ FREERDP_API void remdesk_server_context_free(RemdeskServerContext* context);
}
#endif
-#endif /* FREERDP_CHANNEL_SERVER_REMDESK_H */
+#endif /* FREERDP_CHANNEL_REMDESK_SERVER_REMDESK_H */
diff --git a/include/freerdp/server/shadow.h b/include/freerdp/server/shadow.h
index 94bfc7a49..6cfc6a085 100644
--- a/include/freerdp/server/shadow.h
+++ b/include/freerdp/server/shadow.h
@@ -63,7 +63,7 @@ typedef int (*pfnShadowSubsystemUninit)(rdpShadowSubsystem* subsystem);
typedef int (*pfnShadowSubsystemStart)(rdpShadowSubsystem* subsystem);
typedef int (*pfnShadowSubsystemStop)(rdpShadowSubsystem* subsystem);
-typedef int (*pfnShadowEnumMonitors)(MONITOR_DEF* monitors, int maxMonitors);
+typedef UINT32 (*pfnShadowEnumMonitors)(MONITOR_DEF* monitors, UINT32 maxMonitors);
typedef int (*pfnShadowAuthenticate)(rdpShadowSubsystem* subsystem,
rdpShadowClient* client,
@@ -311,15 +311,15 @@ FREERDP_API int shadow_server_stop(rdpShadowServer* server);
FREERDP_API int shadow_server_init(rdpShadowServer* server);
FREERDP_API int shadow_server_uninit(rdpShadowServer* server);
-FREERDP_API int shadow_enum_monitors(MONITOR_DEF* monitors, int maxMonitors);
+FREERDP_API UINT32 shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors);
-FREERDP_API rdpShadowServer* shadow_server_new();
+FREERDP_API rdpShadowServer* shadow_server_new(void);
FREERDP_API void shadow_server_free(rdpShadowServer* server);
FREERDP_API int shadow_capture_align_clip_rect(RECTANGLE_16* rect,
RECTANGLE_16* clip);
-FREERDP_API int shadow_capture_compare(BYTE* pData1, int nStep1, int nWidth,
- int nHeight, BYTE* pData2, int nStep2, RECTANGLE_16* rect);
+FREERDP_API int shadow_capture_compare(BYTE* pData1, UINT32 nStep1, UINT32 nWidth,
+ UINT32 nHeight, BYTE* pData2, UINT32 nStep2, RECTANGLE_16* rect);
FREERDP_API void shadow_subsystem_frame_update(rdpShadowSubsystem* subsystem);
diff --git a/include/freerdp/session.h b/include/freerdp/session.h
index 9d7ed5198..489453a92 100644
--- a/include/freerdp/session.h
+++ b/include/freerdp/session.h
@@ -16,8 +16,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __FREERDP_SESSION_H__
-#define __FREERDP_SESSION_H__
+#ifndef FREERDP_SESSION_H
+#define FREERDP_SESSION_H
#include <winpr/wtypes.h>
@@ -45,4 +45,4 @@ struct rdp_logon_info_ex {
};
typedef struct rdp_logon_info_ex logon_info_ex;
-#endif /* __FREERDP_SESSION_H__ */
+#endif /* FREERDP_SESSION_H */
diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h
index 6030a5c81..29258518d 100644
--- a/include/freerdp/settings.h
+++ b/include/freerdp/settings.h
@@ -1011,7 +1011,7 @@ struct rdp_settings
ALIGN64 BOOL RestrictedAdminModeRequired; /* 1097 */
ALIGN64 char* AuthenticationServiceClass; /* 1098 */
ALIGN64 BOOL DisableCredentialsDelegation; /* 1099 */
- ALIGN64 BOOL AuthenticationLevel; /* 1100 */
+ ALIGN64 UINT32 AuthenticationLevel; /* 1100 */
ALIGN64 char* AllowedTlsCiphers; /* 1101 */
ALIGN64 BOOL VmConnectMode; /* 1102 */
ALIGN64 char* NtlmSamFile; /* 1103 */
diff --git a/include/freerdp/utils/ringbuffer.h b/include/freerdp/utils/ringbuffer.h
index dfe9e8350..121578673 100644
--- a/include/freerdp/utils/ringbuffer.h
+++ b/include/freerdp/utils/ringbuffer.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __RINGBUFFER_H___
-#define __RINGBUFFER_H___
+#ifndef FREERDP_UTILS_RINGBUFFER_H
+#define FREERDP_UTILS_RINGBUFFER_H
#include <winpr/wtypes.h>
#include <freerdp/api.h>
@@ -125,4 +125,4 @@ FREERDP_API void ringbuffer_commit_read_bytes(RingBuffer *rb, size_t sz);
}
#endif
-#endif /* __RINGBUFFER_H___ */
+#endif /* FREERDP_UTILS_RINGBUFFER_H */
diff --git a/include/freerdp/version.h.in b/include/freerdp/version.h.in
index 74f07efcd..3930dc366 100644
--- a/include/freerdp/version.h.in
+++ b/include/freerdp/version.h.in
@@ -17,8 +17,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef _FREERDP_VERSION_H_
-#define _FREERDP_VERSION_H_
+#ifndef FREERDP_VERSION_H
+#define FREERDP_VERSION_H
#define FREERDP_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}
#define FREERDP_VERSION_MINOR ${FREERDP_VERSION_MINOR}
@@ -29,4 +29,4 @@
#define FREERDP_VERSION_FULL "${FREERDP_VERSION_FULL}"
#define GIT_REVISION "${GIT_REVISION}"
-#endif // _FREERDP_VERSION_H_
+#endif /* FREERDP_VERSION_H */
diff --git a/libfreerdp/codec/nsc_encode.h b/libfreerdp/codec/nsc_encode.h
index 762fa00e0..e220de407 100644
--- a/libfreerdp/codec/nsc_encode.h
+++ b/libfreerdp/codec/nsc_encode.h
@@ -19,12 +19,12 @@
* limitations under the License.
*/
-#ifndef __NSC_ENCODE_H
-#define __NSC_ENCODE_H
+#ifndef FREERDP_LIB_CODEC_NSC_ENCODE_H
+#define FREERDP_LIB_CODEC_NSC_ENCODE_H
#include <freerdp/api.h>
FREERDP_LOCAL void nsc_encode(NSC_CONTEXT* context, const BYTE* bmpdata,
UINT32 rowstride);
-#endif
+#endif /* FREERDP_LIB_CODEC_NSC_ENCODE_H */
diff --git a/libfreerdp/codec/nsc_sse2.h b/libfreerdp/codec/nsc_sse2.h
index 7c735578f..8b795d7bd 100644
--- a/libfreerdp/codec/nsc_sse2.h
+++ b/libfreerdp/codec/nsc_sse2.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __NSC_SSE2_H
-#define __NSC_SSE2_H
+#ifndef FREERDP_LIB_CODEC_NSC_SSE2_H
+#define FREERDP_LIB_CODEC_NSC_SSE2_H
#include <freerdp/codec/nsc.h>
#include <freerdp/api.h>
@@ -31,4 +31,4 @@ FREERDP_LOCAL void nsc_init_sse2(NSC_CONTEXT* context);
#endif
#endif
-#endif /* __NSC_SSE2_H */
+#endif /* FREERDP_LIB_CODEC_NSC_SSE2_H */
diff --git a/libfreerdp/codec/nsc_types.h b/libfreerdp/codec/nsc_types.h
index 28553b8c0..904500886 100644
--- a/libfreerdp/codec/nsc_types.h
+++ b/libfreerdp/codec/nsc_types.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __NSC_TYPES_H
-#define __NSC_TYPES_H
+#ifndef FREERDP_LIB_CODEC_NSC_TYPES_H
+#define FREERDP_LIB_CODEC_NSC_TYPES_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -51,4 +51,4 @@ struct _NSC_CONTEXT_PRIV
PROFILER_DEFINE(prof_nsc_encode);
};
-#endif /* __NSC_TYPES_H */
+#endif /* FREERDP_LIB_CODEC_NSC_TYPES_H */
diff --git a/libfreerdp/codec/planar.c b/libfreerdp/codec/planar.c
index dde1cdaaf..bf62e58c0 100644
--- a/libfreerdp/codec/planar.c
+++ b/libfreerdp/codec/planar.c
@@ -1064,7 +1064,7 @@ BYTE* freerdp_bitmap_planar_delta_encode_plane(const BYTE* inPlane,
if (width * height == 0)
return NULL;
- if (!(outPlane = (BYTE*) malloc(width * height)))
+ if (!(outPlane = (BYTE*) calloc(height, width)))
return NULL;
}
@@ -1269,10 +1269,10 @@ BOOL freerdp_bitmap_planar_context_reset(
free(context->pTempData);
free(context->deltaPlanesBuffer);
free(context->rlePlanesBuffer);
- context->planesBuffer = malloc(context->maxPlaneSize * 4);
- context->pTempData = malloc(context->maxPlaneSize * 4);
- context->deltaPlanesBuffer = malloc(context->maxPlaneSize * 4);
- context->rlePlanesBuffer = malloc(context->maxPlaneSize * 4);
+ context->planesBuffer = calloc(context->maxPlaneSize, 4);
+ context->pTempData = calloc(context->maxPlaneSize, 4);
+ context->deltaPlanesBuffer = calloc(context->maxPlaneSize, 4);
+ context->rlePlanesBuffer = calloc(context->maxPlaneSize, 4);
if (!context->planesBuffer || !context->pTempData ||
!context->deltaPlanesBuffer || !context->rlePlanesBuffer)
diff --git a/libfreerdp/codec/progressive.c b/libfreerdp/codec/progressive.c
index b79408e90..def538408 100644
--- a/libfreerdp/codec/progressive.c
+++ b/libfreerdp/codec/progressive.c
@@ -1938,28 +1938,28 @@ PROGRESSIVE_CONTEXT* progressive_context_new(BOOL Compressor)
progressive->Compressor = Compressor;
progressive->bufferPool = BufferPool_New(TRUE, (8192 + 32) * 3, 16);
progressive->cRects = 64;
- progressive->rects = (RFX_RECT*) malloc(progressive->cRects * sizeof(RFX_RECT));
+ progressive->rects = (RFX_RECT*) calloc(progressive->cRects, sizeof(RFX_RECT));
if (!progressive->rects)
goto cleanup;
progressive->cTiles = 64;
- progressive->tiles = (RFX_PROGRESSIVE_TILE**) malloc(progressive->cTiles *
+ progressive->tiles = (RFX_PROGRESSIVE_TILE**) calloc(progressive->cTiles,
sizeof(RFX_PROGRESSIVE_TILE*));
if (!progressive->tiles)
goto cleanup;
progressive->cQuant = 8;
- progressive->quantVals = (RFX_COMPONENT_CODEC_QUANT*) malloc(
- progressive->cQuant * sizeof(RFX_COMPONENT_CODEC_QUANT));
+ progressive->quantVals = (RFX_COMPONENT_CODEC_QUANT*) calloc(
+ progressive->cQuant, sizeof(RFX_COMPONENT_CODEC_QUANT));
if (!progressive->quantVals)
goto cleanup;
progressive->cProgQuant = 8;
- progressive->quantProgVals = (RFX_PROGRESSIVE_CODEC_QUANT*) malloc(
- progressive->cProgQuant * sizeof(RFX_PROGRESSIVE_CODEC_QUANT));
+ progressive->quantProgVals = (RFX_PROGRESSIVE_CODEC_QUANT*) calloc(
+ progressive->cProgQuant, sizeof(RFX_PROGRESSIVE_CODEC_QUANT));
if (!progressive->quantProgVals)
goto cleanup;
diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c
index a4a1ad8c7..ce03a7406 100644
--- a/libfreerdp/codec/rfx.c
+++ b/libfreerdp/codec/rfx.c
@@ -1618,10 +1618,7 @@ skip_encoding_loop:
success = FALSE;
}
else
- {
- free(message->tiles);
success = FALSE;
- }
}
/* when using threads ensure all computations are done */
diff --git a/libfreerdp/codec/rfx_bitstream.h b/libfreerdp/codec/rfx_bitstream.h
index bb03d399f..14d06c0f7 100644
--- a/libfreerdp/codec/rfx_bitstream.h
+++ b/libfreerdp/codec/rfx_bitstream.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __RFX_BITSTREAM_H
-#define __RFX_BITSTREAM_H
+#ifndef FREERDP_LIB_CODEC_RFX_BITSTREAM_H
+#define FREERDP_LIB_CODEC_RFX_BITSTREAM_H
#include <freerdp/codec/rfx.h>
@@ -82,4 +82,4 @@ typedef struct _RFX_BITSTREAM RFX_BITSTREAM;
#define rfx_bitstream_left(_bs) ((_bs)->byte_pos >= (_bs)->nbytes ? 0 : ((_bs)->nbytes - (_bs)->byte_pos - 1) * 8 + (_bs)->bits_left)
#define rfx_bitstream_get_processed_bytes(_bs) ((_bs)->bits_left < 8 ? (_bs)->byte_pos + 1 : (_bs)->byte_pos)
-#endif /* __RFX_BITSTREAM_H */
+#endif /* FREERDP_LIB_CODEC_RFX_BITSTREAM_H */
diff --git a/libfreerdp/codec/rfx_constants.h b/libfreerdp/codec/rfx_constants.h
index 248210199..43ded828e 100644
--- a/libfreerdp/codec/rfx_constants.h
+++ b/libfreerdp/codec/rfx_constants.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __RFX_CONSTANTS_H
-#define __RFX_CONSTANTS_H
+#ifndef FREERDP_LIB_CODEC_RFX_CONSTANTS_H
+#define FREERDP_LIB_CODEC_RFX_CONSTANTS_H
/* sync */
#define WF_MAGIC 0xCACCACCA
@@ -56,5 +56,5 @@
/* properties.qt */
#define SCALAR_QUANTIZATION 0x1
-#endif /* __RFX_CONSTANTS_H */
+#endif /* FREERDP_LIB_CODEC_RFX_CONSTANTS_H */
diff --git a/libfreerdp/codec/rfx_decode.h b/libfreerdp/codec/rfx_decode.h
index 266dde0a1..9bf9cd94d 100644
--- a/libfreerdp/codec/rfx_decode.h
+++ b/libfreerdp/codec/rfx_decode.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __RFX_DECODE_H
-#define __RFX_DECODE_H
+#ifndef FREERDP_LIB_CODEC_RFX_DECODE_H
+#define FREERDP_LIB_CODEC_RFX_DECODE_H
#include <freerdp/codec/rfx.h>
#include <freerdp/api.h>
@@ -27,5 +27,5 @@
FREERDP_LOCAL BOOL rfx_decode_rgb(RFX_CONTEXT* context, RFX_TILE* tile,
BYTE* rgb_buffer, int stride);
-#endif /* __RFX_DECODE_H */
+#endif /* FREERDP_LIB_CODEC_RFX_DECODE_H */
diff --git a/libfreerdp/codec/rfx_differential.h b/libfreerdp/codec/rfx_differential.h
index 978ca8a7b..f77796991 100644
--- a/libfreerdp/codec/rfx_differential.h
+++ b/libfreerdp/codec/rfx_differential.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __RFX_DIFFERENTIAL_H
-#define __RFX_DIFFERENTIAL_H
+#ifndef FREERDP_LIB_CODEC_RFX_DIFFERENTIAL_H
+#define FREERDP_LIB_CODEC_RFX_DIFFERENTIAL_H
#include <freerdp/codec/rfx.h>
#include <freerdp/api.h>
@@ -48,4 +48,4 @@ static INLINE void rfx_differential_encode(INT16* buffer, int size)
}
}
-#endif /* __RFX_DIFFERENTIAL_H */
+#endif /* FREERDP_LIB_CODEC_RFX_DIFFERENTIAL_H */
diff --git a/libfreerdp/codec/rfx_dwt.h b/libfreerdp/codec/rfx_dwt.h
index 4ba1d6ee7..f5b469284 100644
--- a/libfreerdp/codec/rfx_dwt.h
+++ b/libfreerdp/codec/rfx_dwt.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __RFX_DWT_H
-#define __RFX_DWT_H
+#ifndef FREERDP_LIB_CODEC_RFX_DWT_H
+#define FREERDP_LIB_CODEC_RFX_DWT_H
#include <freerdp/codec/rfx.h>
#include <freerdp/api.h>
@@ -26,4 +26,4 @@
FREERDP_LOCAL void rfx_dwt_2d_decode(INT16* buffer, INT16* dwt_buffer);
FREERDP_LOCAL void rfx_dwt_2d_encode(INT16* buffer, INT16* dwt_buffer);
-#endif /* __RFX_DWT_H */
+#endif /* FREERDP_LIB_CODEC_RFX_DWT_H */
diff --git a/libfreerdp/codec/rfx_encode.h b/libfreerdp/codec/rfx_encode.h
index 3f238c527..ad6ab0e06 100644
--- a/libfreerdp/codec/rfx_encode.h
+++ b/libfreerdp/codec/rfx_encode.h
@@ -17,13 +17,13 @@
* limitations under the License.
*/
-#ifndef __RFX_ENCODE_H
-#define __RFX_ENCODE_H
+#ifndef FREERDP_LIB_CODEC_RFX_ENCODE_H
+#define FREERDP_LIB_CODEC_RFX_ENCODE_H
#include <freerdp/codec/rfx.h>
#include <freerdp/api.h>
FREERDP_LOCAL void rfx_encode_rgb(RFX_CONTEXT* context, RFX_TILE* tile);
-#endif
+#endif /* FREERDP_LIB_CODEC_RFX_ENCODE_H */
diff --git a/libfreerdp/codec/rfx_neon.h b/libfreerdp/codec/rfx_neon.h
index 5ccade8cd..b6216c38a 100644
--- a/libfreerdp/codec/rfx_neon.h
+++ b/libfreerdp/codec/rfx_neon.h
@@ -17,8 +17,8 @@
limitations under the License.
*/
-#ifndef __RFX_NEON_H
-#define __RFX_NEON_H
+#ifndef FREERDP_LIB_CODEC_RFX_NEON_H
+#define FREERDP_LIB_CODEC_RFX_NEON_H
#include <freerdp/codec/rfx.h>
#include <freerdp/api.h>
@@ -31,5 +31,5 @@ FREERDP_LOCAL void rfx_init_neon(RFX_CONTEXT* context);
#endif
#endif
-#endif /* __RFX_NEON_H */
+#endif /* FREERDP_LIB_CODEC_RFX_NEON_H */
diff --git a/libfreerdp/codec/rfx_quantization.h b/libfreerdp/codec/rfx_quantization.h
index 99ac86efd..9349c8976 100644
--- a/libfreerdp/codec/rfx_quantization.h
+++ b/libfreerdp/codec/rfx_quantization.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __RFX_QUANTIZATION_H
-#define __RFX_QUANTIZATION_H
+#ifndef FREERDP_LIB_CODEC_RFX_QUANTIZATION_H
+#define FREERDP_LIB_CODEC_RFX_QUANTIZATION_H
#include <freerdp/codec/rfx.h>
#include <freerdp/api.h>
@@ -31,4 +31,4 @@ FREERDP_LOCAL void rfx_quantization_encode(INT16* buffer,
FREERDP_LOCAL void rfx_quantization_decode_block(const primitives_t* prims,
INT16* buffer, int buffer_size, UINT32 factor);
-#endif /* __RFX_QUANTIZATION_H */
+#endif /* FREERDP_LIB_CODEC_RFX_QUANTIZATION_H */
diff --git a/libfreerdp/codec/rfx_rlgr.h b/libfreerdp/codec/rfx_rlgr.h
index b3b6e3439..49c0d6241 100644
--- a/libfreerdp/codec/rfx_rlgr.h
+++ b/libfreerdp/codec/rfx_rlgr.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __RFX_RLGR_H
-#define __RFX_RLGR_H
+#ifndef FREERDP_LIB_CODEC_RFX_RLGR_H
+#define FREERDP_LIB_CODEC_RFX_RLGR_H
#include <freerdp/codec/rfx.h>
#include <freerdp/api.h>
@@ -29,4 +29,4 @@ FREERDP_LOCAL int rfx_rlgr_encode(RLGR_MODE mode, const INT16* data,
FREERDP_LOCAL int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* pSrcData, UINT32 SrcSize,
INT16* pDstData, UINT32 DstSize);
-#endif /* __RFX_RLGR_H */
+#endif /* FREERDP_LIB_CODEC_RFX_RLGR_H */
diff --git a/libfreerdp/codec/rfx_sse2.h b/libfreerdp/codec/rfx_sse2.h
index 03e40ba36..b0d3998e3 100644
--- a/libfreerdp/codec/rfx_sse2.h
+++ b/libfreerdp/codec/rfx_sse2.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __RFX_SSE2_H
-#define __RFX_SSE2_H
+#ifndef FREERDP_LIB_CODEC_RFX_SSE2_H
+#define FREERDP_LIB_CODEC_RFX_SSE2_H
#include <freerdp/codec/rfx.h>
#include <freerdp/api.h>
@@ -31,4 +31,4 @@ FREERDP_LOCAL void rfx_init_sse2(RFX_CONTEXT* context);
#endif
#endif
-#endif /* __RFX_SSE2_H */
+#endif /* FREERDP_LIB_CODEC_RFX_SSE2_H */
diff --git a/libfreerdp/codec/rfx_types.h b/libfreerdp/codec/rfx_types.h
index 082e14187..e42591f9b 100644
--- a/libfreerdp/codec/rfx_types.h
+++ b/libfreerdp/codec/rfx_types.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef CODEC_RFX_TYPES_H
-#define CODEC_RFX_TYPES_H
+#ifndef FREERDP_LIB_CODEC_RFX_TYPES_H
+#define FREERDP_LIB_CODEC_RFX_TYPES_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -77,4 +77,4 @@ struct _RFX_CONTEXT_PRIV
PROFILER_DEFINE(prof_rfx_encode_format_rgb);
};
-#endif /* __RFX_TYPES_H */
+#endif /* FREERDP_LIB_CODEC_RFX_TYPES_H */
diff --git a/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c b/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c
index 5fff49c8e..7370eb68d 100644
--- a/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c
+++ b/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c
@@ -2968,7 +2968,7 @@ static BOOL RunTestPlanar(BITMAP_PLANAR_CONTEXT* planar, const BYTE* srcBitmap,
UINT32 dstSize;
BYTE* compressedBitmap = freerdp_bitmap_compress_planar(planar,
srcBitmap, srcFormat, width, height, 0, NULL, &dstSize);
- BYTE* decompressedBitmap = (BYTE*) calloc(1, size);
+ BYTE* decompressedBitmap = (BYTE*) calloc(height, width * GetBytesPerPixel(dstFormat));
printf("%s [%s] --> [%s]: ", __FUNCTION__,
GetColorFormatName(srcFormat), GetColorFormatName(dstFormat));
fflush(stdout);
diff --git a/libfreerdp/common/assistance.c b/libfreerdp/common/assistance.c
index fa80686b2..b0fa9ac11 100644
--- a/libfreerdp/common/assistance.c
+++ b/libfreerdp/common/assistance.c
@@ -87,7 +87,7 @@ int freerdp_assistance_crypt_derive_key_sha1(BYTE* hash, int hashLength, BYTE* k
pad2[i] ^= hash[i];
}
- buffer = (BYTE*) calloc(1, hashLength * 2);
+ buffer = (BYTE*) calloc(hashLength, 2);
if (!buffer)
goto fail;
@@ -131,7 +131,7 @@ int freerdp_assistance_parse_address_list(rdpAssistanceFile* file, char* list)
count++;
}
- tokens = (char**) malloc(sizeof(char*) * count);
+ tokens = (char**) calloc(count, sizeof(char*));
if (!tokens)
{
free(str);
@@ -812,7 +812,7 @@ char* freerdp_assistance_bin_to_hex_string(const BYTE* data, int size)
int ln, hn;
char bin2hex[] = "0123456789ABCDEF";
- p = (char*) malloc((size + 1) * 2);
+ p = (char*) calloc((size + 1), 2);
if (!p)
return NULL;
diff --git a/libfreerdp/common/settings.c b/libfreerdp/common/settings.c
index aa804daf2..641590331 100644
--- a/libfreerdp/common/settings.c
+++ b/libfreerdp/common/settings.c
@@ -592,7 +592,7 @@ ADDIN_ARGV* freerdp_dynamic_channel_clone(ADDIN_ARGV* channel)
return NULL;
_channel->argc = channel->argc;
- _channel->argv = (char**) malloc(sizeof(char*) * channel->argc);
+ _channel->argv = (char**) calloc(sizeof(char*), channel->argc);
if (!_channel->argv)
goto out_free;
diff --git a/libfreerdp/core/activation.h b/libfreerdp/core/activation.h
index a6a02a182..31b72e851 100644
--- a/libfreerdp/core/activation.h
+++ b/libfreerdp/core/activation.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __ACTIVATION_H
-#define __ACTIVATION_H
+#ifndef FREERDP_LIB_CORE_ACTIVATION_H
+#define FREERDP_LIB_CORE_ACTIVATION_H
#include "rdp.h"
@@ -64,4 +64,4 @@ FREERDP_LOCAL BOOL rdp_server_accept_client_control_pdu(rdpRdp* rdp,
FREERDP_LOCAL BOOL rdp_server_accept_client_font_list_pdu(rdpRdp* rdp,
wStream* s);
-#endif /* __ACTIVATION_H */
+#endif /* FREERDP_LIB_CORE_ACTIVATION_H */
diff --git a/libfreerdp/core/autodetect.h b/libfreerdp/core/autodetect.h
index 923612248..cbe499e45 100644
--- a/libfreerdp/core/autodetect.h
+++ b/libfreerdp/core/autodetect.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __AUTODETECT_H
-#define __AUTODETECT_H
+#ifndef FREERDP_LIB_CORE_AUTODETECT_H
+#define FREERDP_LIB_CORE_AUTODETECT_H
#include "rdp.h"
@@ -52,4 +52,4 @@ FREERDP_LOCAL BOOL autodetect_send_connecttime_bandwidth_measure_stop(
#define AUTODETECT_TAG FREERDP_TAG("core.autodetect")
-#endif /* __AUTODETECT_H */
+#endif /* FREERDP_LIB_CORE_AUTODETECT_H */
diff --git a/libfreerdp/core/bulk.h b/libfreerdp/core/bulk.h
index 0ce240af1..2151b1a0d 100644
--- a/libfreerdp/core/bulk.h
+++ b/libfreerdp/core/bulk.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_BULK_H
-#define FREERDP_CORE_BULK_H
+#ifndef FREERDP_LIB_CORE_BULK_H
+#define FREERDP_LIB_CORE_BULK_H
typedef struct rdp_bulk rdpBulk;
@@ -59,4 +59,4 @@ FREERDP_LOCAL void bulk_reset(rdpBulk* bulk);
FREERDP_LOCAL rdpBulk* bulk_new(rdpContext* context);
FREERDP_LOCAL void bulk_free(rdpBulk* bulk);
-#endif /* FREERDP_CORE_BULK_H */
+#endif /* FREERDP_LIB_CORE_BULK_H */
diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c
index c083527ae..e026c007a 100644
--- a/libfreerdp/core/capabilities.c
+++ b/libfreerdp/core/capabilities.c
@@ -3769,12 +3769,12 @@ BOOL rdp_recv_get_active_header(rdpRdp* rdp, wStream* s, UINT16* pChannelId)
if (rdp->settings->UseRdpSecurityLayer)
{
- if (!rdp_read_security_header(s, &securityFlags))
+ if (!rdp_read_security_header(s, &securityFlags, &length))
return FALSE;
if (securityFlags & SEC_ENCRYPT)
{
- if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
+ if (!rdp_decrypt(rdp, s, length, securityFlags))
{
WLog_ERR(TAG, "rdp_decrypt failed");
return FALSE;
diff --git a/libfreerdp/core/capabilities.h b/libfreerdp/core/capabilities.h
index d40f49c57..b38d89771 100644
--- a/libfreerdp/core/capabilities.h
+++ b/libfreerdp/core/capabilities.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __CAPABILITIES_H
-#define __CAPABILITIES_H
+#ifndef FREERDP_LIB_CORE_CAPABILITIES_H
+#define FREERDP_LIB_CORE_CAPABILITIES_H
#include "rdp.h"
@@ -181,4 +181,4 @@ FREERDP_LOCAL BOOL rdp_recv_confirm_active(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL BOOL rdp_write_confirm_active(wStream* s, rdpSettings* settings);
FREERDP_LOCAL BOOL rdp_send_confirm_active(rdpRdp* rdp);
-#endif /* __CAPABILITIES_H */
+#endif /* FREERDP_LIB_CORE_CAPABILITIES_H */
diff --git a/libfreerdp/core/certificate.c b/libfreerdp/core/certificate.c
index 515a1024d..f8f7ed4b6 100644
--- a/libfreerdp/core/certificate.c
+++ b/libfreerdp/core/certificate.c
@@ -167,6 +167,11 @@ BOOL certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
int exponent_length;
int error = 0;
+ if (!cert || !info)
+ return FALSE;
+
+ memset(info, 0, sizeof(rdpCertInfo));
+
s = Stream_New(cert->data, cert->length);
if (!s)
@@ -362,7 +367,6 @@ static BOOL certificate_process_server_public_key(rdpCertificate* certificate, w
UINT32 keylen;
UINT32 bitlen;
UINT32 datalen;
- UINT32 modlen;
if (Stream_GetRemainingLength(s) < 20)
return FALSE;
@@ -379,12 +383,11 @@ static BOOL certificate_process_server_public_key(rdpCertificate* certificate, w
Stream_Read_UINT32(s, bitlen);
Stream_Read_UINT32(s, datalen);
Stream_Read(s, certificate->cert_info.exponent, 4);
- modlen = keylen - 8;
- if (Stream_GetRemainingLength(s) < modlen + 8) // count padding
+ if ((keylen <= 8) || (Stream_GetRemainingLength(s) < keylen))
return FALSE;
- certificate->cert_info.ModulusLength = modlen;
+ certificate->cert_info.ModulusLength = keylen - 8;
certificate->cert_info.Modulus = malloc(certificate->cert_info.ModulusLength);
if (!certificate->cert_info.Modulus)
@@ -405,7 +408,7 @@ static BOOL certificate_process_server_public_signature(rdpCertificate* certific
BYTE md5hash[WINPR_MD5_DIGEST_LENGTH];
if (!winpr_Digest(WINPR_MD_MD5, sigdata, sigdatalen, md5hash, sizeof(md5hash)))
- return FALSE;
+ return FALSE;
Stream_Read(s, encsig, siglen);
/* Last 8 bytes shall be all zero. */
@@ -546,7 +549,7 @@ BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate
BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, wStream* s)
{
- int i;
+ UINT32 i;
BOOL ret;
UINT32 certLength;
UINT32 numCertBlobs;
@@ -562,7 +565,7 @@ BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate,
if (!certificate->x509_cert_chain)
return FALSE;
- for (i = 0; i < (int) numCertBlobs; i++)
+ for (i = 0; i < numCertBlobs; i++)
{
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
@@ -621,7 +624,7 @@ BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate,
* @param length certificate length
*/
-BOOL certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length)
+BOOL certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, size_t length)
{
BOOL ret;
wStream* s;
diff --git a/libfreerdp/core/certificate.h b/libfreerdp/core/certificate.h
index 1dd31eb90..cfabda81b 100644
--- a/libfreerdp/core/certificate.h
+++ b/libfreerdp/core/certificate.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __CERTIFICATE_H
-#define __CERTIFICATE_H
+#ifndef FREERDP_LIB_CORE_CERTIFICATE_H
+#define FREERDP_LIB_CORE_CERTIFICATE_H
#include "rdp.h"
@@ -58,7 +58,7 @@ FREERDP_LOCAL BOOL certificate_read_server_proprietary_certificate(
FREERDP_LOCAL BOOL certificate_read_server_x509_certificate_chain(
rdpCertificate* certificate, wStream* s);
FREERDP_LOCAL BOOL certificate_read_server_certificate(rdpCertificate*
- certificate, BYTE* server_cert, int length);
+ certificate, BYTE* server_cert, size_t length);
FREERDP_LOCAL rdpCertificate* certificate_clone(rdpCertificate* certificate);
@@ -77,4 +77,4 @@ FREERDP_LOCAL void key_free(rdpRsaKey* key);
#define DEBUG_CERTIFICATE(...) do { } while (0)
#endif
-#endif /* __CERTIFICATE_H */
+#endif /* FREERDP_LIB_CORE_CERTIFICATE_H */
diff --git a/libfreerdp/core/channels.h b/libfreerdp/core/channels.h
index 43ee8beca..307533f4e 100644
--- a/libfreerdp/core/channels.h
+++ b/libfreerdp/core/channels.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __CHANNEL_H
-#define __CHANNEL_H
+#ifndef FREERDP_LIB_CORE_CHANNELS_H
+#define FREERDP_LIB_CORE_CHANNELS_H
#include <freerdp/api.h>
#include "client.h"
@@ -30,4 +30,4 @@ FREERDP_LOCAL BOOL freerdp_channel_process(freerdp* instance, wStream* s,
FREERDP_LOCAL BOOL freerdp_channel_peer_process(freerdp_peer* client,
wStream* s, UINT16 channelId);
-#endif /* __CHANNEL_H */
+#endif /* FREERDP_LIB_CORE_CHANNELS_H */
diff --git a/libfreerdp/core/client.h b/libfreerdp/core/client.h
index 46900b73c..3f1e1f409 100644
--- a/libfreerdp/core/client.h
+++ b/libfreerdp/core/client.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_CLIENT_H
-#define FREERDP_CORE_CLIENT_H
+#ifndef FREERDP_LIB_CORE_CLIENT_H
+#define FREERDP_LIB_CORE_CLIENT_H
#include <winpr/crt.h>
#include <winpr/stream.h>
@@ -124,4 +124,4 @@ FREERDP_LOCAL UINT freerdp_channels_pre_connect(rdpChannels* channels,
freerdp* instance);
FREERDP_LOCAL UINT freerdp_channels_post_connect(rdpChannels* channels,
freerdp* instance);
-#endif /* FREERDP_CORE_CLIENT_H */
+#endif /* FREERDP_LIB_CORE_CLIENT_H */
diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c
index b3e1ecc27..8499cc7f3 100644
--- a/libfreerdp/core/connection.c
+++ b/libfreerdp/core/connection.c
@@ -429,7 +429,7 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
* client random must be (bitlen / 8) + 8 - see [MS-RDPBCGR] 5.3.4.1
* for details
*/
- crypt_client_random = calloc(1, key_len + 8);
+ crypt_client_random = calloc(key_len + 8, 1);
if (!crypt_client_random)
return FALSE;
@@ -542,7 +542,7 @@ BOOL rdp_server_establish_keys(rdpRdp* rdp, wStream* s)
return FALSE;
}
- if (!rdp_read_security_header(s, &sec_flags))
+ if (!rdp_read_security_header(s, &sec_flags, NULL))
{
WLog_ERR(TAG, "invalid security header");
return FALSE;
@@ -769,12 +769,12 @@ BOOL rdp_client_connect_auto_detect(rdpRdp* rdp, wStream* s)
{
UINT16 securityFlags = 0;
- if (!rdp_read_security_header(s, &securityFlags))
+ if (!rdp_read_security_header(s, &securityFlags, &length))
return FALSE;
if (securityFlags & SEC_ENCRYPT)
{
- if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
+ if (!rdp_decrypt(rdp, s, length, securityFlags))
{
WLog_ERR(TAG, "rdp_decrypt failed");
return FALSE;
diff --git a/libfreerdp/core/connection.h b/libfreerdp/core/connection.h
index 7313b67a0..7a6ebf59d 100644
--- a/libfreerdp/core/connection.h
+++ b/libfreerdp/core/connection.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __CONNECTION_H
-#define __CONNECTION_H
+#ifndef FREERDP_LIB_CORE_CONNECTION_H
+#define FREERDP_LIB_CORE_CONNECTION_H
#include "rdp.h"
#include "tpkt.h"
@@ -75,4 +75,4 @@ FREERDP_LOCAL BOOL rdp_server_establish_keys(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL BOOL rdp_server_reactivate(rdpRdp* rdp);
FREERDP_LOCAL int rdp_server_transition_to_state(rdpRdp* rdp, int state);
-#endif /* __CONNECTION_H */
+#endif /* FREERDP_LIB_CORE_CONNECTION_H */
diff --git a/libfreerdp/core/errinfo.h b/libfreerdp/core/errinfo.h
index 2fa2bc9ea..cc426f30e 100644
--- a/libfreerdp/core/errinfo.h
+++ b/libfreerdp/core/errinfo.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __ERRINFO_H
-#define __ERRINFO_H
+#ifndef FREERDP_LIB_CORE_ERRINFO_H
+#define FREERDP_LIB_CORE_ERRINFO_H
#include <freerdp/freerdp.h>
#include <freerdp/api.h>
@@ -33,4 +33,4 @@ typedef struct _ERRINFO ERRINFO;
FREERDP_LOCAL void rdp_print_errinfo(UINT32 code);
-#endif
+#endif /* FREERDP_LIB_CORE_ERRINFO_H */
diff --git a/libfreerdp/core/fastpath.h b/libfreerdp/core/fastpath.h
index 7b6f942af..970699415 100644
--- a/libfreerdp/core/fastpath.h
+++ b/libfreerdp/core/fastpath.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __FASTPATH_H
-#define __FASTPATH_H
+#ifndef FREERDP_LIB_CORE_FASTPATH_H
+#define FREERDP_LIB_CORE_FASTPATH_H
/*
* Fast-Path has 15 bits available for length information which would lead to a
@@ -174,4 +174,4 @@ FREERDP_LOCAL BOOL fastpath_send_surfcmd_frame_marker(rdpFastPath* fastpath,
FREERDP_LOCAL rdpFastPath* fastpath_new(rdpRdp* rdp);
FREERDP_LOCAL void fastpath_free(rdpFastPath* fastpath);
-#endif
+#endif /* FREERDP_LIB_CORE_FASTPATH_H */
diff --git a/libfreerdp/core/gateway/http.h b/libfreerdp/core/gateway/http.h
index 35f117448..543be7256 100644
--- a/libfreerdp/core/gateway/http.h
+++ b/libfreerdp/core/gateway/http.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_HTTP_H
-#define FREERDP_CORE_HTTP_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_HTTP_H
+#define FREERDP_LIB_CORE_GATEWAY_HTTP_H
typedef struct _http_context HttpContext;
typedef struct _http_request HttpRequest;
@@ -117,4 +117,4 @@ FREERDP_LOCAL HttpResponse* http_response_recv(rdpTls* tls);
FREERDP_LOCAL HttpResponse* http_response_new(void);
FREERDP_LOCAL void http_response_free(HttpResponse* response);
-#endif /* FREERDP_CORE_HTTP_H */
+#endif /* FREERDP_LIB_CORE_GATEWAY_HTTP_H */
diff --git a/libfreerdp/core/gateway/ncacn_http.h b/libfreerdp/core/gateway/ncacn_http.h
index 8f4b49cb9..228047646 100644
--- a/libfreerdp/core/gateway/ncacn_http.h
+++ b/libfreerdp/core/gateway/ncacn_http.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_NCACN_HTTP_H
-#define FREERDP_CORE_NCACN_HTTP_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_NCACN_HTTP_H
+#define FREERDP_LIB_CORE_GATEWAY_NCACN_HTTP_H
#include <freerdp/types.h>
#include <freerdp/settings.h>
@@ -45,4 +45,4 @@ FREERDP_LOCAL int rpc_ncacn_http_send_out_channel_request(rdpRpc* rpc,
FREERDP_LOCAL int rpc_ncacn_http_recv_out_channel_response(rdpRpc* rpc,
RpcOutChannel* outChannel, HttpResponse* response);
-#endif
+#endif /* FREERDP_LIB_CORE_GATEWAY_NCACN_HTTP_H */
diff --git a/libfreerdp/core/gateway/ntlm.c b/libfreerdp/core/gateway/ntlm.c
index ccfcb521a..18dfc108e 100644
--- a/libfreerdp/core/gateway/ntlm.c
+++ b/libfreerdp/core/gateway/ntlm.c
@@ -131,7 +131,7 @@ BOOL ntlm_client_make_spn(rdpNtlm* ntlm, LPCTSTR ServiceClass, char* hostname)
if (DsMakeSpn(ServiceClass, hostnameX, NULL, 0, NULL, &SpnLength, NULL) != ERROR_BUFFER_OVERFLOW)
goto error;
- ntlm->ServicePrincipalName = (LPTSTR) malloc(SpnLength * sizeof(TCHAR));
+ ntlm->ServicePrincipalName = (LPTSTR) calloc(SpnLength, sizeof(TCHAR));
if (!ntlm->ServicePrincipalName)
goto error;
diff --git a/libfreerdp/core/gateway/ntlm.h b/libfreerdp/core/gateway/ntlm.h
index 38b1f007c..f384378c0 100644
--- a/libfreerdp/core/gateway/ntlm.h
+++ b/libfreerdp/core/gateway/ntlm.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_NTLM_H
-#define FREERDP_CORE_NTLM_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_NTLM_H
+#define FREERDP_LIB_CORE_GATEWAY_NTLM_H
typedef struct rdp_ntlm rdpNtlm;
@@ -78,4 +78,4 @@ FREERDP_LOCAL BOOL ntlm_client_make_spn(rdpNtlm* ntlm, LPCTSTR ServiceClass,
FREERDP_LOCAL rdpNtlm* ntlm_new(void);
FREERDP_LOCAL void ntlm_free(rdpNtlm* ntlm);
-#endif /* FREERDP_CORE_NTLM_H */
+#endif /* FREERDP_LIB_CORE_GATEWAY_NTLM_H */
diff --git a/libfreerdp/core/gateway/rdg.h b/libfreerdp/core/gateway/rdg.h
index 2fedd623e..8eca518e0 100644
--- a/libfreerdp/core/gateway/rdg.h
+++ b/libfreerdp/core/gateway/rdg.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_RDG_H
-#define FREERDP_CORE_RDG_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_RDG_H
+#define FREERDP_LIB_CORE_GATEWAY_RDG_H
#include <winpr/wtypes.h>
@@ -153,4 +153,4 @@ FREERDP_LOCAL DWORD rdg_get_event_handles(rdpRdg* rdg, HANDLE* events,
FREERDP_LOCAL BOOL rdg_check_event_handles(rdpRdg* rdg);
-#endif /* FREERDP_CORE_RDG_H */
+#endif /* FREERDP_LIB_CORE_GATEWAY_RDG_H */
diff --git a/libfreerdp/core/gateway/rpc.h b/libfreerdp/core/gateway/rpc.h
index 6702333f0..006b629d3 100644
--- a/libfreerdp/core/gateway/rpc.h
+++ b/libfreerdp/core/gateway/rpc.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_RPC_H
-#define FREERDP_CORE_RPC_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_RPC_H
+#define FREERDP_LIB_CORE_GATEWAY_RPC_H
#include <winpr/wtypes.h>
#include <winpr/stream.h>
@@ -803,4 +803,4 @@ FREERDP_LOCAL BOOL rpc_connect(rdpRpc* rpc, int timeout);
FREERDP_LOCAL rdpRpc* rpc_new(rdpTransport* transport);
FREERDP_LOCAL void rpc_free(rdpRpc* rpc);
-#endif /* FREERDP_CORE_RPC_H */
+#endif /* FREERDP_LIB_CORE_GATEWAY_RPC_H */
diff --git a/libfreerdp/core/gateway/rpc_bind.h b/libfreerdp/core/gateway/rpc_bind.h
index 2c370d4c6..f52e38465 100644
--- a/libfreerdp/core/gateway/rpc_bind.h
+++ b/libfreerdp/core/gateway/rpc_bind.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_RPC_BIND_H
-#define FREERDP_CORE_RPC_BIND_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_RPC_BIND_H
+#define FREERDP_LIB_CORE_GATEWAY_RPC_BIND_H
#include "rpc.h"
@@ -39,4 +39,4 @@ FREERDP_LOCAL int rpc_recv_bind_ack_pdu(rdpRpc* rpc, BYTE* buffer,
UINT32 length);
FREERDP_LOCAL int rpc_send_rpc_auth_3_pdu(rdpRpc* rpc);
-#endif /* FREERDP_CORE_RPC_BIND_H */
+#endif /* FREERDP_LIB_CORE_GATEWAY_RPC_BIND_H */
diff --git a/libfreerdp/core/gateway/rpc_client.h b/libfreerdp/core/gateway/rpc_client.h
index 67ba6564d..a3c31fc4c 100644
--- a/libfreerdp/core/gateway/rpc_client.h
+++ b/libfreerdp/core/gateway/rpc_client.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_RPC_CLIENT_H
-#define FREERDP_CORE_RPC_CLIENT_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_RPC_CLIENT_H
+#define FREERDP_LIB_CORE_GATEWAY_RPC_CLIENT_H
#include <freerdp/api.h>
@@ -45,4 +45,4 @@ FREERDP_LOCAL int rpc_client_write_call(rdpRpc* rpc, BYTE* data, int length,
FREERDP_LOCAL int rpc_client_new(rdpRpc* rpc);
FREERDP_LOCAL void rpc_client_free(rdpRpc* rpc);
-#endif /* FREERDP_CORE_RPC_CLIENT_H */
+#endif /* FREERDP_LIB_CORE_GATEWAY_RPC_CLIENT_H */
diff --git a/libfreerdp/core/gateway/rpc_fault.h b/libfreerdp/core/gateway/rpc_fault.h
index a408f6a52..aa55088c9 100644
--- a/libfreerdp/core/gateway/rpc_fault.h
+++ b/libfreerdp/core/gateway/rpc_fault.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_RPC_FAULT_H
-#define FREERDP_CORE_RPC_FAULT_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_RPC_FAULT_H
+#define FREERDP_LIB_CORE_GATEWAY_RPC_FAULT_H
#include "rpc.h"
@@ -28,4 +28,4 @@
FREERDP_LOCAL int rpc_recv_fault_pdu(rpcconn_hdr_t* header);
FREERDP_LOCAL UINT32 rpc_map_status_code_to_win32_error_code(UINT32 code);
-#endif /* FREERDP_CORE_RPC_FAULT_H */
+#endif /* FREERDP_LIB_CORE_GATEWAY_RPC_FAULT_H */
diff --git a/libfreerdp/core/gateway/rts.h b/libfreerdp/core/gateway/rts.h
index 4fe200319..2f1898b32 100644
--- a/libfreerdp/core/gateway/rts.h
+++ b/libfreerdp/core/gateway/rts.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_RTS_H
-#define FREERDP_CORE_RTS_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_RTS_H
+#define FREERDP_LIB_CORE_GATEWAY_RTS_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -174,4 +174,4 @@ FREERDP_LOCAL int rts_recv_out_of_sequence_pdu(rdpRpc* rpc, BYTE* buffer,
#include "rts_signature.h"
-#endif /* FREERDP_CORE_RTS_H */
+#endif /* FREERDP_LIB_CORE_GATEWAY_RTS_H */
diff --git a/libfreerdp/core/gateway/rts_signature.h b/libfreerdp/core/gateway/rts_signature.h
index ec1494c8d..cb1c96c77 100644
--- a/libfreerdp/core/gateway/rts_signature.h
+++ b/libfreerdp/core/gateway/rts_signature.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_RTS_SIGNATURE_H
-#define FREERDP_CORE_RTS_SIGNATURE_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_RTS_SIGNATURE_H
+#define FREERDP_LIB_CORE_GATEWAY_RTS_SIGNATURE_H
typedef struct rts_pdu_signature RtsPduSignature;
typedef struct _RTS_PDU_SIGNATURE_ENTRY RTS_PDU_SIGNATURE_ENTRY;
@@ -188,4 +188,4 @@ FREERDP_LOCAL UINT32 rts_identify_pdu_signature(rdpRpc* rpc,
FREERDP_LOCAL int rts_print_pdu_signature(rdpRpc* rpc,
RtsPduSignature* signature);
-#endif
+#endif /* FREERDP_LIB_CORE_GATEWAY_RTS_SIGNATURE_H */
diff --git a/libfreerdp/core/gateway/tsg.h b/libfreerdp/core/gateway/tsg.h
index f6ad3416c..f1d61448a 100644
--- a/libfreerdp/core/gateway/tsg.h
+++ b/libfreerdp/core/gateway/tsg.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_TSG_H
-#define FREERDP_CORE_TSG_H
+#ifndef FREERDP_LIB_CORE_GATEWAY_TSG_H
+#define FREERDP_LIB_CORE_GATEWAY_TSG_H
typedef struct rdp_tsg rdpTsg;
@@ -332,4 +332,4 @@ FREERDP_LOCAL void tsg_free(rdpTsg* tsg);
FREERDP_LOCAL BIO_METHOD* BIO_s_tsg(void);
-#endif /* FREERDP_CORE_TSG_H */
+#endif /* FREERDP_LIB_CORE_GATEWAY_TSG_H */
diff --git a/libfreerdp/core/gcc.c b/libfreerdp/core/gcc.c
index ef7302c9c..ae26115ab 100644
--- a/libfreerdp/core/gcc.c
+++ b/libfreerdp/core/gcc.c
@@ -33,6 +33,7 @@
#define TAG FREERDP_TAG("core.gcc")
+
/**
* T.124 GCC is defined in:
*
@@ -1188,38 +1189,50 @@ BOOL gcc_read_server_security_data(wStream* s, rdpMcs* mcs)
Stream_Read_UINT32(s, settings->ServerRandomLength); /* serverRandomLen */
Stream_Read_UINT32(s, settings->ServerCertificateLength); /* serverCertLen */
- if (Stream_GetRemainingLength(s) < settings->ServerRandomLength +
- settings->ServerCertificateLength)
+ if ((settings->ServerRandomLength == 0) || (settings->ServerCertificateLength == 0))
return FALSE;
- if ((settings->ServerRandomLength <= 0)
- || (settings->ServerCertificateLength <= 0))
+ if (Stream_GetRemainingLength(s) < settings->ServerRandomLength)
return FALSE;
/* serverRandom */
settings->ServerRandom = (BYTE*) malloc(settings->ServerRandomLength);
if (!settings->ServerRandom)
- return FALSE;
+ goto fail;
Stream_Read(s, settings->ServerRandom, settings->ServerRandomLength);
+
+ if (Stream_GetRemainingLength(s) < settings->ServerCertificateLength)
+ goto fail;
+
/* serverCertificate */
settings->ServerCertificate = (BYTE*) malloc(settings->ServerCertificateLength);
if (!settings->ServerCertificate)
- return FALSE;
+ goto fail;
Stream_Read(s, settings->ServerCertificate, settings->ServerCertificateLength);
certificate_free(settings->RdpServerCertificate);
settings->RdpServerCertificate = certificate_new();
if (!settings->RdpServerCertificate)
- return FALSE;
+ goto fail;
data = settings->ServerCertificate;
length = settings->ServerCertificateLength;
- return certificate_read_server_certificate(settings->RdpServerCertificate, data,
- length);
+ if (!certificate_read_server_certificate(settings->RdpServerCertificate, data,
+ length))
+ goto fail;
+
+ return TRUE;
+
+fail:
+ free (settings->ServerRandom);
+ free (settings->ServerCertificate);
+ settings->ServerRandom = NULL;
+ settings->ServerCertificate = NULL;
+ return FALSE;
}
static const BYTE initial_signature[] =
diff --git a/libfreerdp/core/gcc.h b/libfreerdp/core/gcc.h
index 500bd73f2..ca5350b4a 100644
--- a/libfreerdp/core/gcc.h
+++ b/libfreerdp/core/gcc.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_GCC_H
-#define FREERDP_CORE_GCC_H
+#ifndef FREERDP_LIB_CORE_GCC_H
+#define FREERDP_LIB_CORE_GCC_H
#include "mcs.h"
@@ -88,4 +88,4 @@ FREERDP_LOCAL BOOL gcc_read_server_multitransport_channel_data(wStream* s,
FREERDP_LOCAL void gcc_write_server_multitransport_channel_data(wStream* s,
rdpMcs* mcs);
-#endif /* FREERDP_CORE_GCC_H */
+#endif /* FREERDP_LIB_CORE_GCC_H */
diff --git a/libfreerdp/core/graphics.h b/libfreerdp/core/graphics.h
index 65b94441d..8738c0faa 100644
--- a/libfreerdp/core/graphics.h
+++ b/libfreerdp/core/graphics.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_GRAPHICS_H
-#define FREERDP_CORE_GRAPHICS_H
+#ifndef FREERDP_LIB_CORE_GRAPHICS_H
+#define FREERDP_LIB_CORE_GRAPHICS_H
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
@@ -27,4 +27,4 @@
FREERDP_LOCAL void Bitmap_Free(rdpContext* context, rdpBitmap* bitmap);
-#endif /* FREERDP_CORE_GRAPHICS_H */
+#endif /* FREERDP_LIB_CORE_GRAPHICS_H */
diff --git a/libfreerdp/core/heartbeat.h b/libfreerdp/core/heartbeat.h
index 877c8f9da..53dfe63dc 100644
--- a/libfreerdp/core/heartbeat.h
+++ b/libfreerdp/core/heartbeat.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __HEARTBEAT_H
-#define __HEARTBEAT_H
+#ifndef FREERDP_LIB_CORE_HEARTBEET_H
+#define FREERDP_LIB_CORE_HEARTBEET_H
typedef struct rdp_heartbeat rdpHeartbeat;
@@ -42,4 +42,4 @@ FREERDP_LOCAL void heartbeat_free(rdpHeartbeat* heartbeat);
#define HEARTBEAT_TAG FREERDP_TAG("core.heartbeat")
-#endif /* __HEARTBEAT_H */
+#endif /* FREERDP_LIB_CORE_HEARTBEET_H */
diff --git a/libfreerdp/core/info.c b/libfreerdp/core/info.c
index 697f247c9..1a0beee31 100644
--- a/libfreerdp/core/info.c
+++ b/libfreerdp/core/info.c
@@ -806,7 +806,7 @@ BOOL rdp_recv_client_info(rdpRdp* rdp, wStream* s)
if (!rdp_read_header(rdp, s, &length, &channelId))
return FALSE;
- if (!rdp_read_security_header(s, &securityFlags))
+ if (!rdp_read_security_header(s, &securityFlags, &length))
return FALSE;
if ((securityFlags & SEC_INFO_PKT) == 0)
@@ -822,7 +822,7 @@ BOOL rdp_recv_client_info(rdpRdp* rdp, wStream* s)
if (securityFlags & SEC_ENCRYPT)
{
- if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
+ if (!rdp_decrypt(rdp, s, length, securityFlags))
{
WLog_ERR(TAG, "rdp_decrypt failed");
return FALSE;
diff --git a/libfreerdp/core/info.h b/libfreerdp/core/info.h
index 6ed61d112..20980d57e 100644
--- a/libfreerdp/core/info.h
+++ b/libfreerdp/core/info.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __INFO_H
-#define __INFO_H
+#ifndef FREERDP_LIB_CORE_INFO_H
+#define FREERDP_LIB_CORE_INFO_H
#include "rdp.h"
@@ -65,4 +65,4 @@ FREERDP_LOCAL BOOL rdp_recv_save_session_info(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL BOOL rdp_send_save_session_info(rdpContext* context, UINT32 type,
void* data);
-#endif /* __INFO_H */
+#endif /* FREERDP_LIB_CORE_INFO_H */
diff --git a/libfreerdp/core/input.h b/libfreerdp/core/input.h
index af49ce0be..a3bb6d586 100644
--- a/libfreerdp/core/input.h
+++ b/libfreerdp/core/input.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __INPUT_H
-#define __INPUT_H
+#ifndef FREERDP_LIB_CORE_INPUT_H
+#define FREERDP_LIB_CORE_INPUT_H
#include "rdp.h"
#include "fastpath.h"
@@ -68,4 +68,4 @@ FREERDP_LOCAL BOOL input_register_client_callbacks(rdpInput* input);
FREERDP_LOCAL rdpInput* input_new(rdpRdp* rdp);
FREERDP_LOCAL void input_free(rdpInput* input);
-#endif /* __INPUT_H */
+#endif /* FREERDP_LIB_CORE_INPUT_H */
diff --git a/libfreerdp/core/license.c b/libfreerdp/core/license.c
index 8b19eae25..407e7691c 100644
--- a/libfreerdp/core/license.c
+++ b/libfreerdp/core/license.c
@@ -36,6 +36,40 @@
/* #define LICENSE_NULL_CLIENT_RANDOM 1 */
/* #define LICENSE_NULL_PREMASTER_SECRET 1 */
+static wStream* license_send_stream_init(rdpLicense* license);
+
+static void license_generate_randoms(rdpLicense* license);
+static BOOL license_generate_keys(rdpLicense* license);
+static BOOL license_generate_hwid(rdpLicense* license);
+static BOOL license_encrypt_premaster_secret(rdpLicense* license);
+static BOOL license_decrypt_platform_challenge(rdpLicense* license);
+
+static LICENSE_PRODUCT_INFO* license_new_product_info(void);
+static void license_free_product_info(LICENSE_PRODUCT_INFO* productInfo);
+static BOOL license_read_product_info(wStream* s, LICENSE_PRODUCT_INFO* productInfo);
+
+static LICENSE_BLOB* license_new_binary_blob(UINT16 type);
+static void license_free_binary_blob(LICENSE_BLOB* blob);
+static BOOL license_read_binary_blob(wStream* s, LICENSE_BLOB* blob);
+static BOOL license_write_binary_blob(wStream* s, LICENSE_BLOB* blob);
+
+static SCOPE_LIST* license_new_scope_list(void);
+static void license_free_scope_list(SCOPE_LIST* scopeList);
+static BOOL license_read_scope_list(wStream* s, SCOPE_LIST* scopeList);
+
+static BOOL license_read_license_request_packet(rdpLicense* license, wStream* s);
+static BOOL license_read_platform_challenge_packet(rdpLicense* license, wStream* s);
+static void license_read_new_license_packet(rdpLicense* license, wStream* s);
+static void license_read_upgrade_license_packet(rdpLicense* license, wStream* s);
+static BOOL license_read_error_alert_packet(rdpLicense* license, wStream* s);
+
+static BOOL license_write_new_license_request_packet(rdpLicense* license, wStream* s);
+static BOOL license_send_new_license_request_packet(rdpLicense* license);
+
+static BOOL license_write_platform_challenge_response_packet(
+ rdpLicense* license, wStream* s, BYTE* mac_data);
+static BOOL license_send_platform_challenge_response_packet(rdpLicense* license);
+
#ifdef WITH_DEBUG_LICENSE
static const char* const LICENSE_MESSAGE_STRINGS[] =
@@ -82,7 +116,7 @@ static const char* const state_transitions[] =
"ST_RESEND_LAST_MESSAGE"
};
-void license_print_product_info(LICENSE_PRODUCT_INFO* productInfo)
+static void license_print_product_info(LICENSE_PRODUCT_INFO* productInfo)
{
char* CompanyName = NULL;
char* ProductId = NULL;
@@ -98,7 +132,7 @@ void license_print_product_info(LICENSE_PRODUCT_INFO* productInfo)
free(ProductId);
}
-void license_print_scope_list(SCOPE_LIST* scopeList)
+static void license_print_scope_list(SCOPE_LIST* scopeList)
{
int index;
LICENSE_BLOB* scope;
@@ -251,12 +285,12 @@ int license_recv(rdpLicense* license, wStream* s)
return -1;
}
- if (!rdp_read_security_header(s, &securityFlags))
+ if (!rdp_read_security_header(s, &securityFlags, &length))
return -1;
if (securityFlags & SEC_ENCRYPT)
{
- if (!rdp_decrypt(license->rdp, s, length - 4, securityFlags))
+ if (!rdp_decrypt(license->rdp, s, length, securityFlags))
{
WLog_ERR(TAG, "rdp_decrypt failed");
return -1;
@@ -463,7 +497,12 @@ BOOL license_decrypt_platform_challenge(rdpLicense* license)
if ((rc4 = winpr_RC4_New(license->LicensingEncryptionKey,
LICENSING_ENCRYPTION_KEY_LENGTH)) == NULL)
+ {
+ free(license->PlatformChallenge->data);
+ license->PlatformChallenge->data = NULL;
+ license->PlatformChallenge->length = 0;
return FALSE;
+ }
rc = winpr_RC4_Update(rc4, license->EncryptedPlatformChallenge->length,
license->EncryptedPlatformChallenge->data,
license->PlatformChallenge->data);
@@ -487,15 +526,27 @@ BOOL license_read_product_info(wStream* s, LICENSE_PRODUCT_INFO* productInfo)
Stream_Read_UINT32(s, productInfo->dwVersion); /* dwVersion (4 bytes) */
Stream_Read_UINT32(s, productInfo->cbCompanyName); /* cbCompanyName (4 bytes) */
- if (Stream_GetRemainingLength(s) < productInfo->cbCompanyName + 4)
+ /* Name must be >0, but there is no upper limit defined, use UINT32_MAX */
+ if ((productInfo->cbCompanyName < 2) || (productInfo->cbCompanyName % 2 != 0))
+ return FALSE;
+
+ if (Stream_GetRemainingLength(s) < productInfo->cbCompanyName)
return FALSE;
+ productInfo->pbProductId = NULL;
productInfo->pbCompanyName = (BYTE*) malloc(productInfo->cbCompanyName);
if (!productInfo->pbCompanyName)
return FALSE;
Stream_Read(s, productInfo->pbCompanyName, productInfo->cbCompanyName);
+
+ if (Stream_GetRemainingLength(s) < 4)
+ goto out_fail;
+
Stream_Read_UINT32(s, productInfo->cbProductId); /* cbProductId (4 bytes) */
+ if ((productInfo->cbProductId < 2) || (productInfo->cbProductId % 2 != 0))
+ goto out_fail;
+
if (Stream_GetRemainingLength(s) < productInfo->cbProductId)
goto out_fail;
@@ -507,7 +558,9 @@ BOOL license_read_product_info(wStream* s, LICENSE_PRODUCT_INFO* productInfo)
out_fail:
free(productInfo->pbCompanyName);
+ free(productInfo->pbProductId);
productInfo->pbCompanyName = NULL;
+ productInfo->pbProductId = NULL;
return FALSE;
}
@@ -681,7 +734,7 @@ BOOL license_read_scope_list(wStream* s, SCOPE_LIST* scopeList)
return FALSE;
scopeList->count = scopeCount;
- scopeList->array = (LICENSE_BLOB*) malloc(sizeof(LICENSE_BLOB) * scopeCount);
+ scopeList->array = (LICENSE_BLOB*) calloc(scopeCount, sizeof(LICENSE_BLOB));
if (!scopeList->array)
return FALSE;
@@ -806,7 +859,9 @@ BOOL license_read_platform_challenge_packet(rdpLicense* license, wStream* s)
Stream_Read_UINT32(s, ConnectFlags); /* ConnectFlags, Reserved (4 bytes) */
/* EncryptedPlatformChallenge */
license->EncryptedPlatformChallenge->type = BB_ANY_BLOB;
- license_read_binary_blob(s, license->EncryptedPlatformChallenge);
+ if (!license_read_binary_blob(s, license->EncryptedPlatformChallenge))
+ return FALSE;
+
license->EncryptedPlatformChallenge->type = BB_ENCRYPTED_DATA_BLOB;
if (Stream_GetRemainingLength(s) < 16)
diff --git a/libfreerdp/core/license.h b/libfreerdp/core/license.h
index 27369cf4f..bf4a351f6 100644
--- a/libfreerdp/core/license.h
+++ b/libfreerdp/core/license.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __LICENSE_H
-#define __LICENSE_H
+#ifndef FREERDP_LIB_CORE_LICENSE_H
+#define FREERDP_LIB_CORE_LICENSE_H
typedef struct rdp_license rdpLicense;
@@ -203,47 +203,6 @@ struct rdp_license
FREERDP_LOCAL int license_recv(rdpLicense* license, wStream* s);
FREERDP_LOCAL BOOL license_send(rdpLicense* license, wStream* s, BYTE type);
-FREERDP_LOCAL wStream* license_send_stream_init(rdpLicense* license);
-
-FREERDP_LOCAL void license_generate_randoms(rdpLicense* license);
-FREERDP_LOCAL BOOL license_generate_keys(rdpLicense* license);
-FREERDP_LOCAL BOOL license_generate_hwid(rdpLicense* license);
-FREERDP_LOCAL BOOL license_encrypt_premaster_secret(rdpLicense* license);
-FREERDP_LOCAL BOOL license_decrypt_platform_challenge(rdpLicense* license);
-
-FREERDP_LOCAL LICENSE_PRODUCT_INFO* license_new_product_info(void);
-FREERDP_LOCAL void license_free_product_info(LICENSE_PRODUCT_INFO* productInfo);
-FREERDP_LOCAL BOOL license_read_product_info(wStream* s,
- LICENSE_PRODUCT_INFO* productInfo);
-
-FREERDP_LOCAL LICENSE_BLOB* license_new_binary_blob(UINT16 type);
-FREERDP_LOCAL void license_free_binary_blob(LICENSE_BLOB* blob);
-FREERDP_LOCAL BOOL license_read_binary_blob(wStream* s, LICENSE_BLOB* blob);
-FREERDP_LOCAL BOOL license_write_binary_blob(wStream* s, LICENSE_BLOB* blob);
-
-FREERDP_LOCAL SCOPE_LIST* license_new_scope_list(void);
-FREERDP_LOCAL void license_free_scope_list(SCOPE_LIST* scopeList);
-FREERDP_LOCAL BOOL license_read_scope_list(wStream* s, SCOPE_LIST* scopeList);
-
-FREERDP_LOCAL BOOL license_read_license_request_packet(rdpLicense* license,
- wStream* s);
-FREERDP_LOCAL BOOL license_read_platform_challenge_packet(rdpLicense* license,
- wStream* s);
-FREERDP_LOCAL void license_read_new_license_packet(rdpLicense* license,
- wStream* s);
-FREERDP_LOCAL void license_read_upgrade_license_packet(rdpLicense* license,
- wStream* s);
-FREERDP_LOCAL BOOL license_read_error_alert_packet(rdpLicense* license,
- wStream* s);
-
-FREERDP_LOCAL BOOL license_write_new_license_request_packet(rdpLicense* license,
- wStream* s);
-FREERDP_LOCAL BOOL license_send_new_license_request_packet(rdpLicense* license);
-
-FREERDP_LOCAL BOOL license_write_platform_challenge_response_packet(
- rdpLicense* license, wStream* s, BYTE* mac_data);
-FREERDP_LOCAL BOOL license_send_platform_challenge_response_packet(
- rdpLicense* license);
FREERDP_LOCAL BOOL license_send_valid_client_error_packet(rdpLicense* license);
@@ -257,4 +216,4 @@ FREERDP_LOCAL void license_free(rdpLicense* license);
#define DEBUG_LICENSE(...) do { } while (0)
#endif
-#endif /* __LICENSE_H */
+#endif /* FREERDP_LIB_CORE_LICENSE_H */
diff --git a/libfreerdp/core/listener.h b/libfreerdp/core/listener.h
index 1474bf7db..720d11877 100644
--- a/libfreerdp/core/listener.h
+++ b/libfreerdp/core/listener.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __LISTENER_H
-#define __LISTENER_H
+#ifndef FREERDP_LIB_CORE_LISTENER_H
+#define FREERDP_LIB_CORE_LISTENER_H
typedef struct rdp_listener rdpListener;
@@ -40,5 +40,5 @@ struct rdp_listener
HANDLE events[MAX_LISTENER_HANDLES];
};
-#endif
+#endif /* FREERDP_LIB_CORE_LISTENER_H */
diff --git a/libfreerdp/core/mcs.c b/libfreerdp/core/mcs.c
index aedb9eae1..cadaa9fa7 100644
--- a/libfreerdp/core/mcs.c
+++ b/libfreerdp/core/mcs.c
@@ -232,7 +232,8 @@ BOOL mcs_read_domain_mcspdu_header(wStream* s, enum DomainMCSPDU* domainMCSPDU,
if (!s || !domainMCSPDU || !length)
return FALSE;
- *length = tpkt_read_header(s);
+ if (!tpkt_read_header(s, length))
+ return FALSE;
if (!tpdu_read_data(s, &li))
return FALSE;
@@ -509,11 +510,13 @@ BOOL mcs_recv_connect_initial(rdpMcs* mcs, wStream* s)
UINT16 li;
int length;
BOOL upwardFlag;
+ UINT16 tlength;
if (!mcs || !s)
return FALSE;
- tpkt_read_header(s);
+ if (!tpkt_read_header(s, &tlength))
+ return FALSE;
if (!tpdu_read_data(s, &li))
return FALSE;
@@ -739,6 +742,7 @@ out:
BOOL mcs_recv_connect_response(rdpMcs* mcs, wStream* s)
{
int length;
+ UINT16 tlength;
BYTE result;
UINT16 li;
UINT32 calledConnectId;
@@ -746,7 +750,8 @@ BOOL mcs_recv_connect_response(rdpMcs* mcs, wStream* s)
if (!mcs || !s)
return FALSE;
- tpkt_read_header(s);
+ if (!tpkt_read_header(s, &tlength))
+ return FALSE;
if (!tpdu_read_data(s, &li))
return FALSE;
diff --git a/libfreerdp/core/mcs.h b/libfreerdp/core/mcs.h
index 8b94cbc04..a48b302be 100644
--- a/libfreerdp/core/mcs.h
+++ b/libfreerdp/core/mcs.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __MCS_H
-#define __MCS_H
+#ifndef FREERDP_LIB_CORE_MCS_H
+#define FREERDP_LIB_CORE_MCS_H
typedef struct rdp_mcs rdpMcs;
@@ -201,4 +201,4 @@ FREERDP_LOCAL BOOL mcs_client_begin(rdpMcs* mcs);
FREERDP_LOCAL rdpMcs* mcs_new(rdpTransport* transport);
FREERDP_LOCAL void mcs_free(rdpMcs* mcs);
-#endif /* __MCS_H */
+#endif /* FREERDP_LIB_CORE_MCS_H */
diff --git a/libfreerdp/core/message.c b/libfreerdp/core/message.c
index 0d0070581..ef4c7361f 100644
--- a/libfreerdp/core/message.c
+++ b/libfreerdp/core/message.c
@@ -115,7 +115,7 @@ static BOOL update_message_BitmapUpdate(rdpContext* context,
wParam->number = bitmap->number;
wParam->count = wParam->number;
- wParam->rectangles = (BITMAP_DATA*) malloc(sizeof(BITMAP_DATA) * wParam->number);
+ wParam->rectangles = (BITMAP_DATA*) calloc(wParam->number, sizeof(BITMAP_DATA));
if (!wParam->rectangles)
{
@@ -213,7 +213,7 @@ static BOOL update_message_RefreshRect(rdpContext* context, BYTE count,
if (!context || !context->update || !areas)
return FALSE;
- lParam = (RECTANGLE_16*) malloc(sizeof(RECTANGLE_16) * count);
+ lParam = (RECTANGLE_16*) calloc(count, sizeof(RECTANGLE_16));
if (!lParam)
return FALSE;
@@ -539,7 +539,7 @@ static BOOL update_message_Polyline(rdpContext* context,
return FALSE;
CopyMemory(wParam, polyline, sizeof(POLYLINE_ORDER));
- wParam->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * wParam->numDeltaEntries);
+ wParam->points = (DELTA_POINT*) calloc(wParam->numDeltaEntries, sizeof(DELTA_POINT));
if (!wParam->points)
{
@@ -692,7 +692,7 @@ static BOOL update_message_PolygonSC(rdpContext* context,
return FALSE;
CopyMemory(wParam, polygonSC, sizeof(POLYGON_SC_ORDER));
- wParam->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * wParam->numPoints);
+ wParam->points = (DELTA_POINT*) calloc(wParam->numPoints, sizeof(DELTA_POINT));
if (!wParam->points)
{
@@ -718,7 +718,7 @@ static BOOL update_message_PolygonCB(rdpContext* context, POLYGON_CB_ORDER* poly
return FALSE;
CopyMemory(wParam, polygonCB, sizeof(POLYGON_CB_ORDER));
- wParam->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * wParam->numPoints);
+ wParam->points = (DELTA_POINT*) calloc(wParam->numPoints, sizeof(DELTA_POINT));
if (!wParam->points)
{
@@ -947,7 +947,7 @@ static BOOL update_message_CreateOffscreenBitmap(
CopyMemory(wParam, createOffscreenBitmap, sizeof(CREATE_OFFSCREEN_BITMAP_ORDER));
wParam->deleteList.cIndices = createOffscreenBitmap->deleteList.cIndices;
wParam->deleteList.sIndices = wParam->deleteList.cIndices;
- wParam->deleteList.indices = (UINT16*) malloc(sizeof(UINT16) * wParam->deleteList.cIndices);
+ wParam->deleteList.indices = (UINT16*) calloc(wParam->deleteList.cIndices, sizeof(UINT16));
if (!wParam->deleteList.indices)
{
@@ -1452,7 +1452,7 @@ static BOOL update_message_MonitoredDesktop(rdpContext* context, WINDOW_ORDER_IN
if (lParam->numWindowIds)
{
- lParam->windowIds = (UINT32*) malloc(sizeof(UINT32) * lParam->numWindowIds);
+ lParam->windowIds = (UINT32*) calloc(lParam->numWindowIds, sizeof(UINT32));
CopyMemory(lParam->windowIds, monitoredDesktop->windowIds, lParam->numWindowIds);
}
diff --git a/libfreerdp/core/message.h b/libfreerdp/core/message.h
index fe8ceb53a..26f78ad09 100644
--- a/libfreerdp/core/message.h
+++ b/libfreerdp/core/message.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_MESSAGE_PRIVATE_H
-#define FREERDP_CORE_MESSAGE_PRIVATE_H
+#ifndef FREERDP_LIB_CORE_MESSAGE_H
+#define FREERDP_LIB_CORE_MESSAGE_H
#include <freerdp/freerdp.h>
#include <freerdp/message.h>
@@ -166,4 +166,4 @@ FREERDP_LOCAL int input_message_queue_process_pending_messages(rdpInput* input);
FREERDP_LOCAL rdpInputProxy* input_message_proxy_new(rdpInput* input);
FREERDP_LOCAL void input_message_proxy_free(rdpInputProxy* proxy);
-#endif /* FREERDP_CORE_MESSAGE_PRIVATE_H */
+#endif /* FREERDP_LIB_CORE_MESSAGE_H */
diff --git a/libfreerdp/core/multitransport.h b/libfreerdp/core/multitransport.h
index fdc3c2fcb..631bc0af0 100644
--- a/libfreerdp/core/multitransport.h
+++ b/libfreerdp/core/multitransport.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __MULTITRANSPORT_H
-#define __MULTITRANSPORT_H
+#ifndef FREERDP_LIB_CORE_MULTITRANSPORT_H
+#define FREERDP_LIB_CORE_MULTITRANSPORT_H
typedef struct rdp_multitransport rdpMultitransport;
@@ -39,4 +39,4 @@ FREERDP_LOCAL int rdp_recv_multitransport_packet(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL rdpMultitransport* multitransport_new(void);
FREERDP_LOCAL void multitransport_free(rdpMultitransport* multitransport);
-#endif /* __MULTITRANSPORT_H */
+#endif /* FREERDP_LIB_CORE_MULTITRANSPORT_H */
diff --git a/libfreerdp/core/nego.c b/libfreerdp/core/nego.c
index d4b023a1c..068a60323 100644
--- a/libfreerdp/core/nego.c
+++ b/libfreerdp/core/nego.c
@@ -575,7 +575,8 @@ int nego_recv(rdpTransport* transport, wStream* s, void* extra)
UINT16 length;
rdpNego* nego = (rdpNego*) extra;
- length = tpkt_read_header(s);
+ if (!tpkt_read_header(s, &length))
+ return -1;
if (length == 0)
return -1;
@@ -739,8 +740,10 @@ BOOL nego_read_request(rdpNego* nego, wStream* s)
{
BYTE li;
BYTE type;
+ UINT16 length;
- tpkt_read_header(s);
+ if (!tpkt_read_header(s, &length))
+ return FALSE;
if (!tpdu_read_connection_request(s, &li))
return FALSE;
diff --git a/libfreerdp/core/nego.h b/libfreerdp/core/nego.h
index fdbce70ff..c03d68d86 100644
--- a/libfreerdp/core/nego.h
+++ b/libfreerdp/core/nego.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_NEGO_H
-#define FREERDP_CORE_NEGO_H
+#ifndef FREERDP_LIB_CORE_NEGO_H
+#define FREERDP_LIB_CORE_NEGO_H
#include "transport.h"
@@ -166,4 +166,4 @@ FREERDP_LOCAL void nego_set_preconnection_id(rdpNego* nego,
FREERDP_LOCAL void nego_set_preconnection_blob(rdpNego* nego,
char* PreconnectionBlob);
-#endif /* __NEGO_H */
+#endif /* FREERDP_LIB_CORE_NEGO_H */
diff --git a/libfreerdp/core/nla.c b/libfreerdp/core/nla.c
index 1970e1a03..63966f562 100644
--- a/libfreerdp/core/nla.c
+++ b/libfreerdp/core/nla.c
@@ -1727,7 +1727,7 @@ LPTSTR nla_make_spn(const char* ServiceClass, const char* hostname)
return NULL;
}
- ServicePrincipalName = (LPTSTR) malloc(SpnLength * sizeof(TCHAR));
+ ServicePrincipalName = (LPTSTR) calloc(SpnLength, sizeof(TCHAR));
if (!ServicePrincipalName)
{
diff --git a/libfreerdp/core/nla.h b/libfreerdp/core/nla.h
index 559add7fe..5039fb43c 100644
--- a/libfreerdp/core/nla.h
+++ b/libfreerdp/core/nla.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_NLA_H
-#define FREERDP_CORE_NLA_H
+#ifndef FREERDP_LIB_CORE_NLA_H
+#define FREERDP_LIB_CORE_NLA_H
typedef struct rdp_nla rdpNla;
@@ -97,4 +97,4 @@ FREERDP_LOCAL rdpNla* nla_new(freerdp* instance, rdpTransport* transport,
rdpSettings* settings);
FREERDP_LOCAL void nla_free(rdpNla* nla);
-#endif /* FREERDP_CORE_NLA_H */
+#endif /* FREERDP_LIB_CORE_NLA_H */
diff --git a/libfreerdp/core/orders.h b/libfreerdp/core/orders.h
index 69b0c4f5c..6692b7c75 100644
--- a/libfreerdp/core/orders.h
+++ b/libfreerdp/core/orders.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __ORDERS_H
-#define __ORDERS_H
+#ifndef FREERDP_LIB_CORE_ORDERS_H
+#define FREERDP_LIB_CORE_ORDERS_H
#include "rdp.h"
@@ -299,4 +299,4 @@ FREERDP_LOCAL BOOL update_write_switch_surface_order(
wStream* s,
const SWITCH_SURFACE_ORDER* switch_surface);
-#endif /* __ORDERS_H */
+#endif /* FREERDP_LIB_CORE_ORDERS_H */
diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c
index fb02f71e9..2d978da43 100644
--- a/libfreerdp/core/peer.c
+++ b/libfreerdp/core/peer.c
@@ -371,12 +371,12 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
if (rdp->settings->UseRdpSecurityLayer)
{
- if (!rdp_read_security_header(s, &securityFlags))
+ if (!rdp_read_security_header(s, &securityFlags, &length))
return -1;
if (securityFlags & SEC_ENCRYPT)
{
- if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
+ if (!rdp_decrypt(rdp, s, length, securityFlags))
{
WLog_ERR(TAG, "rdp_decrypt failed");
return -1;
@@ -418,7 +418,7 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
else if (rdp->mcs->messageChannelId && channelId == rdp->mcs->messageChannelId)
{
if (!rdp->settings->UseRdpSecurityLayer)
- if (!rdp_read_security_header(s, &securityFlags))
+ if (!rdp_read_security_header(s, &securityFlags, NULL))
return -1;
return rdp_recv_message_channel_pdu(rdp, s, securityFlags);
diff --git a/libfreerdp/core/peer.h b/libfreerdp/core/peer.h
index e9cd03937..d9c3bc402 100644
--- a/libfreerdp/core/peer.h
+++ b/libfreerdp/core/peer.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __PEER
-#define __PEER
+#ifndef FREERDP_LIB_CORE_PEER_H
+#define FREERDP_LIB_CORE_PEER_H
#include "rdp.h"
#include "mcs.h"
@@ -26,5 +26,5 @@
#include <freerdp/peer.h>
-#endif /* __PEER */
+#endif /* FREERDP_LIB_CORE_PEER_H */
diff --git a/libfreerdp/core/proxy.c b/libfreerdp/core/proxy.c
index 3ef2a62f8..4835477dc 100644
--- a/libfreerdp/core/proxy.c
+++ b/libfreerdp/core/proxy.c
@@ -133,7 +133,7 @@ BOOL proxy_parse_uri(rdpSettings* settings, const char* uri)
hostnamelen = strlen(hostname);
}
- settings->ProxyHostname = calloc(1, hostnamelen + 1);
+ settings->ProxyHostname = calloc(hostnamelen + 1, 1);
if (!settings->ProxyHostname)
{
diff --git a/libfreerdp/core/proxy.h b/libfreerdp/core/proxy.h
index 9a2212577..1b337a3f1 100644
--- a/libfreerdp/core/proxy.h
+++ b/libfreerdp/core/proxy.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __HTTP_PROXY_H
-#define __HTTP_PROXY_H
+#ifndef FREERDP_LIB_CORE_HTTP_PROXY_H
+#define FREERDP_LIB_CORE_HTTP_PROXY_H
#include "freerdp/settings.h"
#include <openssl/bio.h>
@@ -28,4 +28,4 @@ BOOL proxy_prepare(rdpSettings* settings, const char** lpPeerHostname, UINT16* l
BOOL proxy_parse_uri(rdpSettings* settings, const char* uri);
BOOL proxy_connect(rdpSettings* settings, BIO* bio, const char* hostname, UINT16 port);
-#endif
+#endif /* FREERDP_LIB_CORE_HTTP_PROXY_H */
diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c
index f89d9c25e..a76b2c4ff 100644
--- a/libfreerdp/core/rdp.c
+++ b/libfreerdp/core/rdp.c
@@ -79,13 +79,17 @@ const char* DATA_PDU_TYPE_STRINGS[80] =
* @param flags security flags
*/
-BOOL rdp_read_security_header(wStream* s, UINT16* flags)
+BOOL rdp_read_security_header(wStream* s, UINT16* flags, UINT16* length)
{
/* Basic Security Header */
- if (Stream_GetRemainingLength(s) < 4)
+ if ((Stream_GetRemainingLength(s) < 4) || (length && (*length < 4)))
return FALSE;
Stream_Read_UINT16(s, *flags); /* flags */
Stream_Seek(s, 2); /* flagsHi (unused) */
+
+ if (length)
+ *length -= 4;
+
return TRUE;
}
@@ -301,7 +305,8 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
MCSPDU = (rdp->settings->ServerMode) ? DomainMCSPDU_SendDataRequest : DomainMCSPDU_SendDataIndication;
- *length = tpkt_read_header(s);
+ if (!tpkt_read_header(s, length))
+ return FALSE;
if (!tpdu_read_header(s, &code, &li))
return FALSE;
@@ -330,7 +335,10 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
MCSPDU = domainMCSPDU;
- if ((size_t) (*length - 8) > Stream_GetRemainingLength(s))
+ if (*length < 8)
+ return FALSE;
+
+ if ((*length - 8) > Stream_GetRemainingLength(s))
return FALSE;
if (MCSPDU == DomainMCSPDU_DisconnectProviderUltimatum)
@@ -376,8 +384,12 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
if (Stream_GetRemainingLength(s) < 5)
return FALSE;
- per_read_integer16(s, &initiator, MCS_BASE_CHANNEL_ID); /* initiator (UserId) */
- per_read_integer16(s, channelId, 0); /* channelId */
+ if (!per_read_integer16(s, &initiator, MCS_BASE_CHANNEL_ID)) /* initiator (UserId) */
+ return FALSE;
+
+ if (!per_read_integer16(s, channelId, 0)) /* channelId */
+ return FALSE;
+
Stream_Read_UINT8(s, byte); /* dataPriority + Segmentation (0x70) */
if (!per_read_length(s, length)) /* userData (OCTET_STRING) */
@@ -1030,17 +1042,21 @@ void rdp_read_flow_control_pdu(wStream* s, UINT16* type)
* @param length int
*/
-BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags)
+BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, INT32 length, UINT16 securityFlags)
{
BYTE cmac[8];
BYTE wmac[8];
BOOL status;
+ if (!rdp || !s || (length < 0))
+ return FALSE;
+
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
{
UINT16 len;
BYTE version, pad;
BYTE* sig;
+ INT64 padLength;
if (Stream_GetRemainingLength(s) < 12)
return FALSE;
@@ -1053,6 +1069,9 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags)
Stream_Seek(s, 8); /* signature */
length -= 12;
+ padLength = length - pad;
+ if ((length <= 0) || (padLength <= 0))
+ return FALSE;
if (!security_fips_decrypt(Stream_Pointer(s), length, rdp))
{
@@ -1070,11 +1089,13 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags)
return TRUE;
}
- if (Stream_GetRemainingLength(s) < 8)
+ if (Stream_GetRemainingLength(s) < sizeof(wmac))
return FALSE;
Stream_Read(s, wmac, sizeof(wmac));
length -= sizeof(wmac);
+ if (length <= 0)
+ return FALSE;
if (!security_decrypt(Stream_Pointer(s), length, rdp))
return FALSE;
@@ -1135,7 +1156,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
if (rdp->settings->UseRdpSecurityLayer)
{
- if (!rdp_read_security_header(s, &securityFlags))
+ if (!rdp_read_security_header(s, &securityFlags, &length))
{
WLog_ERR(TAG, "rdp_recv_tpkt_pdu: rdp_read_security_header() fail");
return -1;
@@ -1143,7 +1164,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
if (securityFlags & (SEC_ENCRYPT | SEC_REDIRECTION_PKT))
{
- if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
+ if (!rdp_decrypt(rdp, s, length, securityFlags))
{
WLog_ERR(TAG, "rdp_decrypt failed");
return -1;
@@ -1216,7 +1237,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
else if (rdp->mcs->messageChannelId && channelId == rdp->mcs->messageChannelId)
{
if (!rdp->settings->UseRdpSecurityLayer)
- if (!rdp_read_security_header(s, &securityFlags))
+ if (!rdp_read_security_header(s, &securityFlags, NULL))
return -1;
return rdp_recv_message_channel_pdu(rdp, s, securityFlags);
diff --git a/libfreerdp/core/rdp.h b/libfreerdp/core/rdp.h
index 484e38217..d9a8cbc44 100644
--- a/libfreerdp/core/rdp.h
+++ b/libfreerdp/core/rdp.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __RDP_H
-#define __RDP_H
+#ifndef FREERDP_LIB_CORE_RDP_H
+#define FREERDP_LIB_CORE_RDP_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -177,7 +177,7 @@ struct rdp_rdp
BOOL AwaitCapabilities;
};
-FREERDP_LOCAL BOOL rdp_read_security_header(wStream* s, UINT16* flags);
+FREERDP_LOCAL BOOL rdp_read_security_header(wStream* s, UINT16* flags, UINT16* length);
FREERDP_LOCAL void rdp_write_security_header(wStream* s, UINT16 flags);
FREERDP_LOCAL BOOL rdp_read_share_control_header(wStream* s, UINT16* length,
@@ -245,9 +245,9 @@ extern const char* DATA_PDU_TYPE_STRINGS[80];
#define DEBUG_RDP(...) do { } while (0)
#endif
-BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags);
+BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, INT32 length, UINT16 securityFlags);
BOOL rdp_set_error_info(rdpRdp* rdp, UINT32 errorInfo);
BOOL rdp_send_error_info(rdpRdp* rdp);
-#endif /* __RDP_H */
+#endif /* FREERDP_LIB_CORE_RDP_H */
diff --git a/libfreerdp/core/redirection.c b/libfreerdp/core/redirection.c
index 9492adfd3..af030aa07 100644
--- a/libfreerdp/core/redirection.c
+++ b/libfreerdp/core/redirection.c
@@ -217,7 +217,7 @@ int rdp_redirection_apply_settings(rdpRdp* rdp)
UINT32 i;
freerdp_target_net_addresses_free(settings);
settings->TargetNetAddressCount = redirection->TargetNetAddressesCount;
- settings->TargetNetAddresses = (char**) malloc(sizeof(char*) * settings->TargetNetAddressCount);
+ settings->TargetNetAddresses = (char**) calloc(settings->TargetNetAddressCount, sizeof(char*));
if (!settings->TargetNetAddresses)
{
settings->TargetNetAddressCount = 0;
diff --git a/libfreerdp/core/redirection.h b/libfreerdp/core/redirection.h
index cf6bca7ab..cfe5f0fd7 100644
--- a/libfreerdp/core/redirection.h
+++ b/libfreerdp/core/redirection.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __REDIRECTION_H
-#define __REDIRECTION_H
+#ifndef FREERDP_LIB_CORE_REDIRECTION_H
+#define FREERDP_LIB_CORE_REDIRECTION_H
typedef struct rdp_redirection rdpRedirection;
@@ -65,4 +65,4 @@ FREERDP_LOCAL void redirection_free(rdpRedirection* redirection);
#define DEBUG_REDIR(...) do { } while (0)
#endif
-#endif /* __REDIRECTION_H */
+#endif /* FREERDP_LIB_CORE_REDIRECTION_H */
diff --git a/libfreerdp/core/security.c b/libfreerdp/core/security.c
index 28a7e42be..807f58fc4 100644
--- a/libfreerdp/core/security.c
+++ b/libfreerdp/core/security.c
@@ -637,7 +637,7 @@ out:
return result;
}
-BOOL security_encrypt(BYTE* data, int length, rdpRdp* rdp)
+BOOL security_encrypt(BYTE* data, size_t length, rdpRdp* rdp)
{
if (rdp->encrypt_use_count >= 4096)
{
@@ -659,7 +659,7 @@ BOOL security_encrypt(BYTE* data, int length, rdpRdp* rdp)
return TRUE;
}
-BOOL security_decrypt(BYTE* data, int length, rdpRdp* rdp)
+BOOL security_decrypt(BYTE* data, size_t length, rdpRdp* rdp)
{
if (rdp->rc4_decrypt_key == NULL)
return FALSE;
@@ -683,7 +683,7 @@ BOOL security_decrypt(BYTE* data, int length, rdpRdp* rdp)
return TRUE;
}
-BOOL security_hmac_signature(const BYTE* data, int length, BYTE* output, rdpRdp* rdp)
+BOOL security_hmac_signature(const BYTE* data, size_t length, BYTE* output, rdpRdp* rdp)
{
BYTE buf[WINPR_SHA1_DIGEST_LENGTH];
BYTE use_count_le[4];
@@ -710,7 +710,7 @@ out:
return result;
}
-BOOL security_fips_encrypt(BYTE* data, int length, rdpRdp* rdp)
+BOOL security_fips_encrypt(BYTE* data, size_t length, rdpRdp* rdp)
{
size_t olen;
@@ -720,7 +720,7 @@ BOOL security_fips_encrypt(BYTE* data, int length, rdpRdp* rdp)
return TRUE;
}
-BOOL security_fips_decrypt(BYTE* data, int length, rdpRdp* rdp)
+BOOL security_fips_decrypt(BYTE* data, size_t length, rdpRdp* rdp)
{
size_t olen;
@@ -729,7 +729,7 @@ BOOL security_fips_decrypt(BYTE* data, int length, rdpRdp* rdp)
return TRUE;
}
-BOOL security_fips_check_signature(const BYTE* data, int length, const BYTE* sig, rdpRdp* rdp)
+BOOL security_fips_check_signature(const BYTE* data, size_t length, const BYTE* sig, rdpRdp* rdp)
{
BYTE buf[WINPR_SHA1_DIGEST_LENGTH];
BYTE use_count_le[4];
diff --git a/libfreerdp/core/security.h b/libfreerdp/core/security.h
index 34bbbcd72..1617bc57d 100644
--- a/libfreerdp/core/security.h
+++ b/libfreerdp/core/security.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __SECURITY_H
-#define __SECURITY_H
+#ifndef FREERDP_LIB_CORE_SECURITY_H
+#define FREERDP_LIB_CORE_SECURITY_H
#include "rdp.h"
#include <freerdp/crypto/crypto.h>
@@ -45,13 +45,13 @@ FREERDP_LOCAL BOOL security_salted_mac_signature(rdpRdp* rdp, const BYTE* data,
UINT32 length, BOOL encryption, BYTE* output);
FREERDP_LOCAL BOOL security_establish_keys(const BYTE* client_random,
rdpRdp* rdp);
-FREERDP_LOCAL BOOL security_encrypt(BYTE* data, int length, rdpRdp* rdp);
-FREERDP_LOCAL BOOL security_decrypt(BYTE* data, int length, rdpRdp* rdp);
-FREERDP_LOCAL BOOL security_hmac_signature(const BYTE* data, int length,
+FREERDP_LOCAL BOOL security_encrypt(BYTE* data, size_t length, rdpRdp* rdp);
+FREERDP_LOCAL BOOL security_decrypt(BYTE* data, size_t length, rdpRdp* rdp);
+FREERDP_LOCAL BOOL security_hmac_signature(const BYTE* data, size_t length,
BYTE* output, rdpRdp* rdp);
-FREERDP_LOCAL BOOL security_fips_encrypt(BYTE* data, int length, rdpRdp* rdp);
-FREERDP_LOCAL BOOL security_fips_decrypt(BYTE* data, int length, rdpRdp* rdp);
-FREERDP_LOCAL BOOL security_fips_check_signature(const BYTE* data, int length,
+FREERDP_LOCAL BOOL security_fips_encrypt(BYTE* data, size_t length, rdpRdp* rdp);
+FREERDP_LOCAL BOOL security_fips_decrypt(BYTE* data, size_t length, rdpRdp* rdp);
+FREERDP_LOCAL BOOL security_fips_check_signature(const BYTE* data, size_t length,
const BYTE* sig, rdpRdp* rdp);
-#endif /* __SECURITY_H */
+#endif /* FREERDP_LIB_CORE_SECURITY_H */
diff --git a/libfreerdp/core/server.h b/libfreerdp/core/server.h
index 01c656679..f543606ec 100644
--- a/libfreerdp/core/server.h
+++ b/libfreerdp/core/server.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CORE_SERVER_H
-#define FREERDP_CORE_SERVER_H
+#ifndef FREERDP_LIB_CORE_SERVER_H
+#define FREERDP_LIB_CORE_SERVER_H
#include <freerdp/freerdp.h>
#include <freerdp/api.h>
@@ -247,4 +247,4 @@ FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSLogoffUser(HANDLE hServer);
FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSLogonUser(HANDLE hServer, LPCSTR username,
LPCSTR password, LPCSTR domain);
-#endif /* FREERDP_CORE_SERVER_H */
+#endif /* FREERDP_LIB_CORE_SERVER_H */
diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c
index 9af8b714a..ef4dd8ebd 100644
--- a/libfreerdp/core/settings.c
+++ b/libfreerdp/core/settings.c
@@ -769,8 +769,8 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
if (_settings->ChannelDefArraySize > 0)
{
- _settings->ChannelDefArray = (CHANNEL_DEF*) malloc(sizeof(
- CHANNEL_DEF) * settings->ChannelDefArraySize);
+ _settings->ChannelDefArray = (CHANNEL_DEF*) calloc(settings->ChannelDefArraySize,
+ sizeof(CHANNEL_DEF));
if (!_settings->ChannelDefArray)
goto out_fail;
@@ -786,8 +786,8 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
if (_settings->MonitorDefArraySize > 0)
{
- _settings->MonitorDefArray = (rdpMonitor*) malloc(sizeof(
- rdpMonitor) * settings->MonitorDefArraySize);
+ _settings->MonitorDefArray = (rdpMonitor*) calloc(settings->MonitorDefArraySize,
+ sizeof(rdpMonitor));
if (!_settings->MonitorDefArray)
goto out_fail;
diff --git a/libfreerdp/core/surface.h b/libfreerdp/core/surface.h
index 89d4fa610..2176714d5 100644
--- a/libfreerdp/core/surface.h
+++ b/libfreerdp/core/surface.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __SURFACE
-#define __SURFACE
+#ifndef FREERDP_LIB_CORE_SURFACE_H
+#define FREERDP_LIB_CORE_SURFACE_H
#include "rdp.h"
@@ -43,5 +43,5 @@ FREERDP_LOCAL BOOL update_write_surfcmd_surface_bits_header(wStream* s,
FREERDP_LOCAL BOOL update_write_surfcmd_frame_marker(wStream* s,
UINT16 frameAction, UINT32 frameId);
-#endif /* __SURFACE */
+#endif /* FREERDP_LIB_CORE_SURFACE_H */
diff --git a/libfreerdp/core/tcp.h b/libfreerdp/core/tcp.h
index 4e72b80ea..6638c19b0 100644
--- a/libfreerdp/core/tcp.h
+++ b/libfreerdp/core/tcp.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __TCP_H
-#define __TCP_H
+#ifndef FREERDP_LIB_CORE_TCP_H
+#define FREERDP_LIB_CORE_TCP_H
#include <winpr/windows.h>
@@ -67,4 +67,4 @@ FREERDP_LOCAL int freerdp_tcp_connect(rdpContext* context,
rdpSettings* settings,
const char* hostname, int port, int timeout);
-#endif /* __TCP_H */
+#endif /* FREERDP_LIB_CORE_TCP_H */
diff --git a/libfreerdp/core/timezone.h b/libfreerdp/core/timezone.h
index ba9a2e280..6e721d2e6 100644
--- a/libfreerdp/core/timezone.h
+++ b/libfreerdp/core/timezone.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __TIMEZONE_H
-#define __TIMEZONE_H
+#ifndef FREERDP_LIB_CORE_TIMEZONE_H
+#define FREERDP_LIB_CORE_TIMEZONE_H
#include "rdp.h"
@@ -43,4 +43,4 @@ FREERDP_LOCAL BOOL rdp_write_client_time_zone(wStream* s,
#define DEBUG_TIMEZONE(...) do { } while (0)
#endif
-#endif /* __TIMEZONE_H */
+#endif /* FREERDP_LIB_CORE_TIMEZONE_H */
diff --git a/libfreerdp/core/tpdu.h b/libfreerdp/core/tpdu.h
index 93f59dfee..fc28c3bf2 100644
--- a/libfreerdp/core/tpdu.h
+++ b/libfreerdp/core/tpdu.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __TPDU_H
-#define __TPDU_H
+#ifndef FREERDP_LIB_CORE_TPDU_H
+#define FREERDP_LIB_CORE_TPDU_H
#include <winpr/stream.h>
#include <freerdp/api.h>
@@ -52,4 +52,4 @@ FREERDP_LOCAL void tpdu_write_disconnect_request(wStream* s, UINT16 length);
FREERDP_LOCAL BOOL tpdu_read_data(wStream* s, UINT16* li);
FREERDP_LOCAL void tpdu_write_data(wStream* s);
-#endif /* __TPDU_H */
+#endif /* FREERDP_LIB_CORE_TPDU_H */
diff --git a/libfreerdp/core/tpkt.c b/libfreerdp/core/tpkt.c
index 5689d62e4..eed79d731 100644
--- a/libfreerdp/core/tpkt.c
+++ b/libfreerdp/core/tpkt.c
@@ -78,28 +78,39 @@ BOOL tpkt_verify_header(wStream* s)
/**
* Read a TPKT header.\n
* @param s
- * @return length
+ * @param length
+ * @return success
*/
-UINT16 tpkt_read_header(wStream* s)
+BOOL tpkt_read_header(wStream* s, UINT16* length)
{
BYTE version;
- UINT16 length;
+
+ if (Stream_GetRemainingLength(s) < 1)
+ return FALSE;
Stream_Peek_UINT8(s, version);
if (version == 3)
{
+ UINT16 len;
+ if (Stream_GetRemainingLength(s) < 4)
+ return FALSE;
+
Stream_Seek(s, 2);
- Stream_Read_UINT16_BE(s, length);
+ Stream_Read_UINT16_BE(s, len);
+ if (len < 4)
+ return FALSE;
+
+ *length = len;
}
else
{
/* not a TPKT header */
- length = 0;
+ *length = 0;
}
- return length;
+ return TRUE;
}
/**
diff --git a/libfreerdp/core/tpkt.h b/libfreerdp/core/tpkt.h
index 55ce1dd18..cb264d4a3 100644
--- a/libfreerdp/core/tpkt.h
+++ b/libfreerdp/core/tpkt.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __TPKT_H
-#define __TPKT_H
+#ifndef FREERDP_LIB_CORE_TPKT_H
+#define FREERDP_LIB_CORE_TPKT_H
#include "tpdu.h"
#include "transport.h"
@@ -29,7 +29,7 @@
#define TPKT_HEADER_LENGTH 4
FREERDP_LOCAL BOOL tpkt_verify_header(wStream* s);
-FREERDP_LOCAL UINT16 tpkt_read_header(wStream* s);
+FREERDP_LOCAL BOOL tpkt_read_header(wStream* s, UINT16* length);
FREERDP_LOCAL void tpkt_write_header(wStream* s, UINT16 length);
-#endif /* __TPKT_H */
+#endif /* FREERDP_LIB_CORE_TPKT_H */
diff --git a/libfreerdp/core/transport.h b/libfreerdp/core/transport.h
index f265450e4..1f82506a9 100644
--- a/libfreerdp/core/transport.h
+++ b/libfreerdp/core/transport.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __TRANSPORT_H
-#define __TRANSPORT_H
+#ifndef FREERDP_LIB_CORE_TRANSPORT_H
+#define FREERDP_LIB_CORE_TRANSPORT_H
typedef enum
{
@@ -123,4 +123,4 @@ FREERDP_LOCAL int transport_receive_pool_return(rdpTransport* transport,
FREERDP_LOCAL rdpTransport* transport_new(rdpContext* context);
FREERDP_LOCAL void transport_free(rdpTransport* transport);
-#endif
+#endif /* FREERDP_LIB_CORE_TRANSPORT_H */
diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c
index 245fc3b6e..d2d911279 100644
--- a/libfreerdp/core/update.c
+++ b/libfreerdp/core/update.c
@@ -1898,7 +1898,7 @@ BOOL update_read_refresh_rect(rdpUpdate* update, wStream* s)
if (Stream_GetRemainingLength(s) < ((size_t) numberOfAreas * 4 * 2))
return FALSE;
- areas = (RECTANGLE_16*) malloc(sizeof(RECTANGLE_16) * numberOfAreas);
+ areas = (RECTANGLE_16*) calloc(numberOfAreas, sizeof(RECTANGLE_16));
if (!areas)
return FALSE;
@@ -2103,7 +2103,7 @@ rdpUpdate* update_new(rdpRdp* rdp)
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
deleteList->sIndices = 64;
- deleteList->indices = malloc(deleteList->sIndices * 2);
+ deleteList->indices = calloc(deleteList->sIndices, 2);
if (!deleteList->indices)
goto error_indices;
diff --git a/libfreerdp/core/update.h b/libfreerdp/core/update.h
index 8f71c7a43..d9b43d00a 100644
--- a/libfreerdp/core/update.h
+++ b/libfreerdp/core/update.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __UPDATE_H
-#define __UPDATE_H
+#ifndef FREERDP_LIB_CORE_UPDATE_H
+#define FREERDP_LIB_CORE_UPDATE_H
#include "rdp.h"
#include "orders.h"
@@ -67,4 +67,4 @@ FREERDP_LOCAL void update_register_server_callbacks(rdpUpdate* update);
FREERDP_LOCAL void update_register_client_callbacks(rdpUpdate* update);
FREERDP_LOCAL int update_process_messages(rdpUpdate* update);
-#endif /* __UPDATE_H */
+#endif /* FREERDP_LIB_CORE_UPDATE_H */
diff --git a/libfreerdp/core/window.h b/libfreerdp/core/window.h
index e9e173c93..7bb8a2040 100644
--- a/libfreerdp/core/window.h
+++ b/libfreerdp/core/window.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef __WINDOW_H
-#define __WINDOW_H
+#ifndef FREERDP_LIB_CORE_WINDOW_H
+#define FREERDP_LIB_CORE_WINDOW_H
#include "update.h"
@@ -38,4 +38,4 @@ FREERDP_LOCAL BOOL update_recv_altsec_window_order(rdpUpdate* update,
#define DEBUG_WND(...) do { } while (0)
#endif
-#endif /* __WINDOW_H */
+#endif /* FREERDP_LIB_CORE_WINDOW_H */
diff --git a/libfreerdp/crypto/crypto.c b/libfreerdp/crypto/crypto.c
index dadc388eb..15e65d534 100644
--- a/libfreerdp/crypto/crypto.c
+++ b/libfreerdp/crypto/crypto.c
@@ -213,7 +213,7 @@ char* crypto_cert_fingerprint(X509* xcert)
X509_digest(xcert, EVP_sha1(), fp, &fp_len);
- fp_buffer = (char*) calloc(3, fp_len);
+ fp_buffer = (char*) calloc(fp_len, 3);
if (!fp_buffer)
return NULL;
@@ -330,11 +330,11 @@ char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths)
num_subject_alt_names = sk_GENERAL_NAME_num(subject_alt_names);
if (num_subject_alt_names)
{
- strings = (char**) malloc(sizeof(char*) * num_subject_alt_names);
+ strings = (char**) calloc(num_subject_alt_names, sizeof(char*));
if (!strings)
goto out;
- *lengths = (int*) malloc(sizeof(int) * num_subject_alt_names);
+ *lengths = (int*) calloc(num_subject_alt_names, sizeof(int));
if (!*lengths)
{
free(strings);
diff --git a/libfreerdp/crypto/opensslcompat.h b/libfreerdp/crypto/opensslcompat.h
index b42d32fd2..911a90080 100644
--- a/libfreerdp/crypto/opensslcompat.h
+++ b/libfreerdp/crypto/opensslcompat.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_CRYPTO_OPENSSLCOMPAT_H
-#define FREERDP_CRYPTO_OPENSSLCOMPAT_H
+#ifndef FREERDP_LIB_CRYPTO_OPENSSLCOMPAT_H
+#define FREERDP_LIB_CRYPTO_OPENSSLCOMPAT_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -62,4 +62,4 @@ void RSA_get0_key(const RSA* r, const BIGNUM** n, const BIGNUM** e, const BIGNUM
#endif /* OPENSSL < 1.1.0 || LIBRESSL */
#endif /* WITH_OPENSSL */
-#endif /* FREERDP_CRYPTO_OPENSSLCOMPAT_H */
+#endif /* FREERDP_LIB_CRYPTO_OPENSSLCOMPAT_H */
diff --git a/libfreerdp/gdi/brush.h b/libfreerdp/gdi/brush.h
index a9dd30fde..0be63660f 100644
--- a/libfreerdp/gdi/brush.h
+++ b/libfreerdp/gdi/brush.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_GDI_BRUSH_H
-#define FREERDP_GDI_BRUSH_H
+#ifndef FREERDP_LIB_GDI_BRUSH_H
+#define FREERDP_LIB_GDI_BRUSH_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
@@ -47,4 +47,4 @@ static INLINE UINT32 gdi_GetBrushStyle(HGDI_DC hdc)
}
#endif
-#endif /* FREERDP_GDI_BRUSH_H */
+#endif /* FREERDP_LIB_GDI_BRUSH_H */
diff --git a/libfreerdp/gdi/clipping.h b/libfreerdp/gdi/clipping.h
index 5e403dbb3..d7ebf6b3b 100644
--- a/libfreerdp/gdi/clipping.h
+++ b/libfreerdp/gdi/clipping.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_GDI_CLIPPING_H
-#define FREERDP_GDI_CLIPPING_H
+#ifndef FREERDP_LIB_GDI_CLIPPING_H
+#define FREERDP_LIB_GDI_CLIPPING_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
@@ -40,4 +40,4 @@ FREERDP_LOCAL BOOL gdi_ClipCoords(HGDI_DC hdc, UINT32* x, UINT32* y,
}
#endif
-#endif /* FREERDP_GDI_CLIPPING_H */
+#endif /* FREERDP_LIB_GDI_CLIPPING_H */
diff --git a/libfreerdp/gdi/drawing.h b/libfreerdp/gdi/drawing.h
index a69cff54d..94daef965 100644
--- a/libfreerdp/gdi/drawing.h
+++ b/libfreerdp/gdi/drawing.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_GDI_DRAWING_H
-#define FREERDP_GDI_DRAWING_H
+#ifndef FREERDP_LIB_GDI_DRAWING_H
+#define FREERDP_LIB_GDI_DRAWING_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
@@ -41,4 +41,4 @@ FREERDP_LOCAL UINT32 gdi_SetTextColor(HGDI_DC hdc, UINT32 crColor);
}
#endif
-#endif /* FREERDP_GDI_DRAWING_H */
+#endif /* FREERDP_LIB_GDI_DRAWING_H */
diff --git a/libfreerdp/gdi/gdi.h b/libfreerdp/gdi/gdi.h
index 2d74fcb61..e17f310a5 100644
--- a/libfreerdp/gdi/gdi.h
+++ b/libfreerdp/gdi/gdi.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __GDI_CORE_H
-#define __GDI_CORE_H
+#ifndef FREERDP_LIB_GDI_CORE_H
+#define FREERDP_LIB_GDI_CORE_H
#include "graphics.h"
#include "brush.h"
@@ -92,4 +92,4 @@ static INLINE BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, UINT32 x, UINT32 y)
return p;
}
-#endif /* __GDI_CORE_H */
+#endif /* FREERDP_LIB_GDI_CORE_H */
diff --git a/libfreerdp/gdi/gfx.c b/libfreerdp/gdi/gfx.c
index d067ae124..d6d003082 100644
--- a/libfreerdp/gdi/gfx.c
+++ b/libfreerdp/gdi/gfx.c
@@ -760,7 +760,7 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context,
const RDPGFX_CREATE_SURFACE_PDU* createSurface)
{
gdiGfxSurface* surface;
- rdpGdi* gdi = (rdpGdi*) context->custom;
+ rdpGdi* gdi = (rdpGdi*) context->custom;
surface = (gdiGfxSurface*) calloc(1, sizeof(gdiGfxSurface));
if (!surface)
@@ -992,7 +992,7 @@ static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
cacheEntry->height = (UINT32)(rect->bottom - rect->top);
cacheEntry->format = surface->format;
cacheEntry->scanline = gfx_align_scanline(cacheEntry->width * 4, 16);
- cacheEntry->data = (BYTE*) calloc(1, cacheEntry->scanline * cacheEntry->height);
+ cacheEntry->data = (BYTE*) calloc(cacheEntry->height, cacheEntry->scanline);
if (!cacheEntry->data)
{
diff --git a/libfreerdp/gdi/graphics.h b/libfreerdp/gdi/graphics.h
index 0f9d4edec..1c6e166d6 100644
--- a/libfreerdp/gdi/graphics.h
+++ b/libfreerdp/gdi/graphics.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef __GDI_GRAPHICS_H
-#define __GDI_GRAPHICS_H
+#ifndef FREERDP_LIB_GDI_GRAPHICS_H
+#define FREERDP_LIB_GDI_GRAPHICS_H
#include <freerdp/gdi/gdi.h>
#include <freerdp/graphics.h>
@@ -32,4 +32,4 @@ FREERDP_LOCAL HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, UINT32 width,
FREERDP_LOCAL BOOL gdi_register_graphics(rdpGraphics* graphics);
-#endif /* __GDI_GRAPHICS_H */
+#endif /* FREERDP_LIB_GDI_GRAPHICS_H */
diff --git a/libfreerdp/gdi/line.h b/libfreerdp/gdi/line.h
index 4bced80a4..f583ca61c 100644
--- a/libfreerdp/gdi/line.h
+++ b/libfreerdp/gdi/line.h
@@ -19,8 +19,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_GDI_LINE_H
-#define FREERDP_GDI_LINE_H
+#ifndef FREERDP_LIB_GDI_LINE_H
+#define FREERDP_LIB_GDI_LINE_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
@@ -41,4 +41,4 @@ FREERDP_LOCAL BOOL gdi_MoveToEx(HGDI_DC hdc, UINT32 X, UINT32 Y,
}
#endif
-#endif /* FREERDP_GDI_LINE_H */
+#endif /* FREERDP_LIB_GDI_LINE_H */
diff --git a/libfreerdp/locale/keyboard_layout.c b/libfreerdp/locale/keyboard_layout.c
index 91bec80f8..74beb94f0 100644
--- a/libfreerdp/locale/keyboard_layout.c
+++ b/libfreerdp/locale/keyboard_layout.c
@@ -229,7 +229,7 @@ RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(DWORD types)
RDP_KEYBOARD_LAYOUT* new;
num = 0;
- layouts = (RDP_KEYBOARD_LAYOUT*) malloc((num + 1) * sizeof(RDP_KEYBOARD_LAYOUT));
+ layouts = (RDP_KEYBOARD_LAYOUT*) calloc((num + 1), sizeof(RDP_KEYBOARD_LAYOUT));
if (!layouts)
return NULL;
diff --git a/libfreerdp/locale/keyboard_xkbfile.h b/libfreerdp/locale/keyboard_xkbfile.h
index b4d6b61af..72fd6089e 100644
--- a/libfreerdp/locale/keyboard_xkbfile.h
+++ b/libfreerdp/locale/keyboard_xkbfile.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __LOCALE_KEYBOARD_XKB_H
-#define __LOCALE_KEYBOARD_XKB_H
+#ifndef FREERDP_LIB_LOCALE_KEYBOARD_XKB_H
+#define FREERDP_LIB_LOCALE_KEYBOARD_XKB_H
#include <freerdp/types.h>
#include <freerdp/locale/keyboard.h>
@@ -32,4 +32,4 @@ FREERDP_LOCAL int detect_keyboard_layout_from_xkbfile(void* display,
FREERDP_LOCAL int freerdp_keyboard_load_map_from_xkbfile(void* display,
DWORD x11_keycode_to_rdp_scancode[256]);
-#endif /* __LOCALE_KEYBOARD_XKB_H */
+#endif /* FREERDP_LIB_LOCALE_KEYBOARD_XKB_H */
diff --git a/libfreerdp/locale/liblocale.h b/libfreerdp/locale/liblocale.h
index 34fa8c2c4..b9310fa96 100644
--- a/libfreerdp/locale/liblocale.h
+++ b/libfreerdp/locale/liblocale.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __LIBLOCALE_H
-#define __LIBLOCALE_H
+#ifndef FREERDP_LIB_LOCALE_LIB_H
+#define FREERDP_LIB_LOCALE_LIB_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -40,4 +40,4 @@
#define DEBUG_TIMEZONE(...) do { } while (0)
#endif
-#endif /* __LIBLOCALE_H */
+#endif /* FREERDP_LIB_LOCALE_LIB_H */
diff --git a/libfreerdp/locale/xkb_layout_ids.h b/libfreerdp/locale/xkb_layout_ids.h
index 84d5cc104..1816f0878 100644
--- a/libfreerdp/locale/xkb_layout_ids.h
+++ b/libfreerdp/locale/xkb_layout_ids.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __FREERDP_XKB_LAYOUT_IDS_H
-#define __FREERDP_XKB_LAYOUT_IDS_H
+#ifndef FREERDP_LIB_LOCALE_XKB_LAYOUT_IDS_H
+#define FREERDP_LIB_LOCALE_XKB_LAYOUT_IDS_H
#include <freerdp/types.h>
#include <freerdp/api.h>
@@ -26,4 +26,4 @@
FREERDP_LOCAL UINT32 find_keyboard_layout_in_xorg_rules(char* layout,
char* variant);
-#endif /* __FREERDP_XKB_LAYOUT_IDS_H */
+#endif /* FREERDP_LIB_LOCALE_XKB_LAYOUT_IDS_H */
diff --git a/libfreerdp/primitives/prim_internal.h b/libfreerdp/primitives/prim_internal.h
index f931212e3..3cd7b1d4e 100644
--- a/libfreerdp/primitives/prim_internal.h
+++ b/libfreerdp/primitives/prim_internal.h
@@ -14,12 +14,8 @@
*
*/
-#ifdef __GNUC__
-# pragma once
-#endif
-
-#ifndef __PRIM_INTERNAL_H_INCLUDED__
-#define __PRIM_INTERNAL_H_INCLUDED__
+#ifndef FREERDP_LIB_PRIM_INTERNAL_H
+#define FREERDP_LIB_PRIM_INTERNAL_H
#ifndef CMAKE_BUILD_TYPE
#define CMAKE_BUILD_TYPE Release
@@ -193,4 +189,4 @@ FREERDP_LOCAL void primitives_init_colors_opt(primitives_t* prims);
FREERDP_LOCAL void primitives_init_YCoCg_opt(primitives_t* prims);
FREERDP_LOCAL void primitives_init_YUV_opt(primitives_t* prims);
-#endif /* !__PRIM_INTERNAL_H_INCLUDED__ */
+#endif /* FREERDP_LIB_PRIM_INTERNAL_H */
diff --git a/libfreerdp/primitives/prim_templates.h b/libfreerdp/primitives/prim_templates.h
index ba2405c43..b68c67049 100644
--- a/libfreerdp/primitives/prim_templates.h
+++ b/libfreerdp/primitives/prim_templates.h
@@ -17,8 +17,8 @@
# pragma once
#endif
-#ifndef __PRIM_TEMPLATES_H_INCLUDED__
-#define __PRIM_TEMPLATES_H_INCLUDED__
+#ifndef FREERDP_LIB_PRIM_TEMPLATES_H
+#define FREERDP_LIB_PRIM_TEMPLATES_H
/* These are prototypes for SSE (potentially NEON) routines that do a
* simple SSE operation over an array of data. Since so much of this
@@ -415,4 +415,4 @@
return PRIMITIVES_SUCCESS; \
}
-#endif /* !__PRIM_TEMPLATES_H_INCLUDED__ */
+#endif /* FREERDP_LIB_PRIM_TEMPLATES_H */
diff --git a/libfreerdp/primitives/test/TestPrimitivesYCbCr.c b/libfreerdp/primitives/test/TestPrimitivesYCbCr.c
index 050ac6475..7c28d8a4f 100644
--- a/libfreerdp/primitives/test/TestPrimitivesYCbCr.c
+++ b/libfreerdp/primitives/test/TestPrimitivesYCbCr.c
@@ -2162,7 +2162,7 @@ static int test_PrimitivesYCbCr(const primitives_t* prims, UINT32 format, prim_s
BYTE* actual1;
BYTE* expected;
int margin = 1;
- INT16* pYCbCr[3];
+ INT16* pYCbCr[3] = { NULL, NULL, NULL };
const UINT32 srcStride = roi.width * 2;
const UINT32 dstStride = roi.width * GetBytesPerPixel(format);
const UINT32 srcSize = srcStride * roi.height;
diff --git a/libfreerdp/primitives/test/TestPrimitivesYCoCg.c b/libfreerdp/primitives/test/TestPrimitivesYCoCg.c
index de09ccaf2..c115336a5 100644
--- a/libfreerdp/primitives/test/TestPrimitivesYCoCg.c
+++ b/libfreerdp/primitives/test/TestPrimitivesYCoCg.c
@@ -52,7 +52,7 @@ static BOOL test_YCoCgRToRGB_8u_AC4R_func(UINT32 width, UINT32 height)
if (!in || !out_c || !out_sse)
goto fail;
- winpr_RAND(in, sizeof(in));
+ winpr_RAND(in, size);
for (x = 0; x < sizeof(formats) / sizeof(formats[0]); x++)
{
diff --git a/libfreerdp/primitives/test/prim_test.h b/libfreerdp/primitives/test/prim_test.h
index 45519f37b..761e36fd5 100644
--- a/libfreerdp/primitives/test/prim_test.h
+++ b/libfreerdp/primitives/test/prim_test.h
@@ -13,8 +13,8 @@
* this code may be covered by patents by HP, Microsoft, or other parties.
*/
-#ifndef __PRIMTEST_H_INCLUDED__
-#define __PRIMTEST_H_INCLUDED__
+#ifndef FREERDP_LIB_PRIMTEST_H
+#define FREERDP_LIB_PRIMTEST_H
#include <winpr/crt.h>
#include <winpr/spec.h>
@@ -57,4 +57,4 @@ BOOL speed_test(const char* name, const char* dsc, UINT32 iterations,
speed_test_fkt generic, speed_test_fkt optimized,
...);
-#endif // !__PRIMTEST_H_INCLUDED__
+#endif /* FREERDP_LIB_PRIMTEST_H */
diff --git a/rdtk/librdtk/rdtk_surface.c b/rdtk/librdtk/rdtk_surface.c
index 03e64e9e0..8e20cdf1b 100644
--- a/rdtk/librdtk/rdtk_surface.c
+++ b/rdtk/librdtk/rdtk_surface.c
@@ -56,7 +56,7 @@ rdtkSurface* rdtk_surface_new(rdtkEngine* engine, BYTE* data, int width, int hei
{
surface->scanline = (surface->width + (surface->width % 4)) * 4;
- surface->data = (BYTE*) malloc(surface->scanline * surface->height);
+ surface->data = (BYTE*) calloc(surface->height, surface->scanline);
if (!surface->data)
{
diff --git a/rdtk/sample/rdtk_x11.c b/rdtk/sample/rdtk_x11.c
index c632e5529..dbe8c2787 100644
--- a/rdtk/sample/rdtk_x11.c
+++ b/rdtk/sample/rdtk_x11.c
@@ -99,7 +99,7 @@ int main(int argc, char** argv)
return 1;
scanline = width * 4;
- buffer = (BYTE*) malloc(scanline * height);
+ buffer = (BYTE*) calloc(height, scanline);
if (!buffer)
return 1;
diff --git a/server/Mac/mf_audin.h b/server/Mac/mf_audin.h
index d3e172b97..e50e119b8 100644
--- a/server/Mac/mf_audin.h
+++ b/server/Mac/mf_audin.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef MF_AUDIN_H
-#define MF_AUDIN_H
+#ifndef FREERDP_SERVER_MAC_AUDIN_H
+#define FREERDP_SERVER_MAC_AUDIN_H
#include <freerdp/freerdp.h>
#include <freerdp/listener.h>
@@ -30,5 +30,5 @@
void mf_peer_audin_init(mfPeerContext* context);
-#endif /* MF_AUDIN_H */
+#endif /* FREERDP_SERVER_MAC_AUDIN_H */
diff --git a/server/Mac/mf_event.h b/server/Mac/mf_event.h
index a9111a67f..883ba4132 100644
--- a/server/Mac/mf_event.h
+++ b/server/Mac/mf_event.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef __MF_EVENT_H
-#define __MF_EVENT_H
+#ifndef FREERDP_SERVER_MAC_EVENT_H
+#define FREERDP_SERVER_MAC_EVENT_H
typedef struct mf_event mfEvent;
typedef struct mf_event_queue mfEventQueue;
@@ -31,8 +31,8 @@ typedef struct mf_event_region mfEventRegion;
enum mf_event_type
{
- MF_EVENT_TYPE_REGION,
- MF_EVENT_TYPE_FRAME_TICK
+ FREERDP_SERVER_MAC_EVENT_TYPE_REGION,
+ FREERDP_SERVER_MAC_EVENT_TYPE_FRAME_TICK
};
struct mf_event
@@ -72,4 +72,4 @@ void mf_event_free(mfEvent* event);
mfEventQueue* mf_event_queue_new(void);
void mf_event_queue_free(mfEventQueue* event_queue);
-#endif /* __MF_EVENT_H */
+#endif /* FREERDP_SERVER_MAC_EVENT_H */
diff --git a/server/Mac/mf_info.h b/server/Mac/mf_info.h
index da420c3f5..9c092a0cb 100644
--- a/server/Mac/mf_info.h
+++ b/server/Mac/mf_info.h
@@ -17,11 +17,11 @@
* limitations under the License.
*/
-#ifndef MF_INFO_H
-#define MF_INFO_H
+#ifndef FREERDP_SERVER_MAC_INFO_H
+#define FREERDP_SERVER_MAC_INFO_H
-#define MF_INFO_DEFAULT_FPS 1
-#define MF_INFO_MAXPEERS 1
+#define FREERDP_SERVER_MAC_INFO_DEFAULT_FPS 1
+#define FREERDP_SERVER_MAC_INFO_MAXPEERS 1
@@ -47,4 +47,4 @@ BOOL mf_info_have_invalid_region(mfInfo* mfi);
void mf_info_getScreenData(mfInfo* mfi, long* width, long* height, BYTE** pBits, int* pitch);
//BOOL CALLBACK mf_info_monEnumCB(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
-#endif /* mf_info_H */
+#endif /* FREERDP_SERVER_MAC_INFO_H */
diff --git a/server/Mac/mf_input.h b/server/Mac/mf_input.h
index 09be9af48..8e8903cfb 100644
--- a/server/Mac/mf_input.h
+++ b/server/Mac/mf_input.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef MF_INPUT_H
-#define MF_INPUT_H
+#ifndef FREERDP_SERVER_MAC_INPUT_H
+#define FREERDP_SERVER_MAC_INPUT_H
#include "mf_interface.h"
@@ -33,4 +33,4 @@ void mf_input_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16
void mf_input_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
void mf_input_extended_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
-#endif /* MF_INPUT_H */ \ No newline at end of file
+#endif /* FREERDP_SERVER_MAC_INPUT_H */ \ No newline at end of file
diff --git a/server/Mac/mf_interface.h b/server/Mac/mf_interface.h
index 80c10172f..9019d684e 100644
--- a/server/Mac/mf_interface.h
+++ b/server/Mac/mf_interface.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef MF_INTERFACE_H
-#define MF_INTERFACE_H
+#ifndef FREERDP_SERVER_MAC_INTERFACE_H
+#define FREERDP_SERVER_MAC_INTERFACE_H
#include <pthread.h>
@@ -102,4 +102,4 @@ struct mf_info
BOOL force_all_disconnect;
};
-#endif
+#endif /* FREERDP_SERVER_MAC_INTERFACE_H */
diff --git a/server/Mac/mf_mountain_lion.h b/server/Mac/mf_mountain_lion.h
index 4b840f057..1790a3cca 100644
--- a/server/Mac/mf_mountain_lion.h
+++ b/server/Mac/mf_mountain_lion.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef MF_MLION_H
-#define MF_MLION_H
+#ifndef FREERDP_SERVER_MAC_MLION_H
+#define FREERDP_SERVER_MAC_MLION_H
#include <freerdp/codec/rfx.h>
@@ -36,4 +36,4 @@ int mf_mlion_clear_dirty_region(void);
int mf_mlion_get_pixelData(long x, long y, long width, long height, BYTE **pxData);
-#endif
+#endif /* FREERDP_SERVER_MAC_MLION_H */
diff --git a/server/Mac/mf_peer.h b/server/Mac/mf_peer.h
index 02a6b1730..9b137dbad 100644
--- a/server/Mac/mf_peer.h
+++ b/server/Mac/mf_peer.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef WF_PEER_H
-#define WF_PEER_H
+#ifndef FREERDP_SERVER_MAC_PEER_H
+#define FREERDP_SERVER_MAC_PEER_H
#include "mf_interface.h"
@@ -41,4 +41,4 @@ BOOL mf_peer_accepted(freerdp_listener* instance, freerdp_peer* client);
void* mf_peer_main_loop(void* arg);
-#endif /* MF_PEER_H */
+#endif /* FREERDP_SERVER_MAC_PEER_H */
diff --git a/server/Mac/mf_rdpsnd.h b/server/Mac/mf_rdpsnd.h
index dedc09d24..ea9099699 100644
--- a/server/Mac/mf_rdpsnd.h
+++ b/server/Mac/mf_rdpsnd.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef MF_RDPSND_H
-#define MF_RDPSND_H
+#ifndef FREERDP_SERVER_MAC_RDPSND_H
+#define FREERDP_SERVER_MAC_RDPSND_H
#include <CoreAudio/CoreAudio.h>
#include <AudioToolbox/AudioToolbox.h>
@@ -62,5 +62,5 @@ typedef struct _AQRecorderState AQRecorderState;
BOOL mf_peer_rdpsnd_init(mfPeerContext* context);
BOOL mf_peer_rdpsnd_stop(void);
-#endif /* MF_RDPSND_H */
+#endif /* FREERDP_SERVER_MAC_RDPSND_H */
diff --git a/server/Mac/mfreerdp.h b/server/Mac/mfreerdp.h
index 2008b2581..38fa25bbd 100644
--- a/server/Mac/mfreerdp.h
+++ b/server/Mac/mfreerdp.h
@@ -18,11 +18,11 @@
* limitations under the License.
*/
-#ifndef MFREERDP_SERVER_H
-#define MFREERDP_SERVER_H
+#ifndef FREERDP_SERVER_MAC_FREERDP_H
+#define FREERDP_SERVER_MAC_FREERDP_H
#include <freerdp/freerdp.h>
#include <freerdp/listener.h>
#include <freerdp/codec/rfx.h>
-#endif /* MFREERDP_SERVER_H */
+#endif /* FREERDP_SERVER_MAC_FREERDP_H */
diff --git a/server/Sample/sf_audin.h b/server/Sample/sf_audin.h
index db762fc55..e99321c87 100644
--- a/server/Sample/sf_audin.h
+++ b/server/Sample/sf_audin.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef SF_AUDIN_H
-#define SF_AUDIN_H
+#ifndef FREERDP_SERVER_SAMPLE_SF_AUDIN_H
+#define FREERDP_SERVER_SAMPLE_SF_AUDIN_H
#include <freerdp/freerdp.h>
#include <freerdp/listener.h>
@@ -28,5 +28,5 @@
void sf_peer_audin_init(testPeerContext* context);
-#endif /* WF_AUDIN_H */
+#endif /* FREERDP_SERVER_SAMPLE_SF_AUDIN_H */
diff --git a/server/Sample/sf_encomsp.h b/server/Sample/sf_encomsp.h
index 27703145d..7976abc1c 100644
--- a/server/Sample/sf_encomsp.h
+++ b/server/Sample/sf_encomsp.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef SF_ENCOMSP_H
-#define SF_ENCOMSP_H
+#ifndef FREERDP_SERVER_SAMPLE_SF_ENCOMSP_H
+#define FREERDP_SERVER_SAMPLE_SF_ENCOMSP_H
#include <freerdp/freerdp.h>
#include <freerdp/listener.h>
@@ -28,4 +28,4 @@
BOOL sf_peer_encomsp_init(testPeerContext* context);
-#endif /* SF_ENCOMSP_H */
+#endif /* FREERDP_SERVER_SAMPLE_SF_ENCOMSP_H */
diff --git a/server/Sample/sf_rdpsnd.h b/server/Sample/sf_rdpsnd.h
index 78e7c9bbd..7da3f5acf 100644
--- a/server/Sample/sf_rdpsnd.h
+++ b/server/Sample/sf_rdpsnd.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef SF_RDPSND_H
-#define SF_RDPSND_H
+#ifndef FREERDP_SERVER_SAMPLE_SF_RDPSND_H
+#define FREERDP_SERVER_SAMPLE_SF_RDPSND_H
#include <freerdp/freerdp.h>
#include <freerdp/listener.h>
@@ -28,5 +28,5 @@
BOOL sf_peer_rdpsnd_init(testPeerContext* context);
-#endif /* SF_RDPSND_H */
+#endif /* FREERDP_SERVER_SAMPLE_SF_RDPSND_H */
diff --git a/server/Sample/sfreerdp.c b/server/Sample/sfreerdp.c
index a63731749..c60a229ca 100644
--- a/server/Sample/sfreerdp.c
+++ b/server/Sample/sfreerdp.c
@@ -266,7 +266,7 @@ static BOOL test_peer_load_icon(freerdp_peer* client)
/* Max */
fgets(line, sizeof(line), fp);
- if (!(rgb_data = malloc(context->icon_width * context->icon_height * 3)))
+ if (!(rgb_data = calloc(context->icon_height, context->icon_width * 3)))
goto out_fail;
for (i = 0; i < context->icon_width * context->icon_height * 3; i++)
@@ -278,8 +278,7 @@ static BOOL test_peer_load_icon(freerdp_peer* client)
}
/* background with same size, which will be used to erase the icon from old position */
- if (!(context->bg_data = malloc(context->icon_width * context->icon_height *
- 3)))
+ if (!(context->bg_data = calloc(context->icon_height, context->icon_width * 3)))
goto out_fail;
memset(context->bg_data, 0xA0, context->icon_width * context->icon_height * 3);
diff --git a/server/Sample/sfreerdp.h b/server/Sample/sfreerdp.h
index 1b81d82a4..529282efd 100644
--- a/server/Sample/sfreerdp.h
+++ b/server/Sample/sfreerdp.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef SFREERDP_SERVER_H
-#define SFREERDP_SERVER_H
+#ifndef FREERDP_SERVER_SAMPLE_SFREERDP_SERVER_H
+#define FREERDP_SERVER_SAMPLE_SFREERDP_SERVER_H
#include <freerdp/freerdp.h>
#include <freerdp/listener.h>
@@ -60,5 +60,5 @@ struct test_peer_context
};
typedef struct test_peer_context testPeerContext;
-#endif /* SFREERDP_SERVER_H */
+#endif /* FREERDP_SERVER_SAMPLE_SFREERDP_SERVER_H */
diff --git a/server/Windows/cli/wfreerdp.h b/server/Windows/cli/wfreerdp.h
index f3ab71cb0..017106db4 100644
--- a/server/Windows/cli/wfreerdp.h
+++ b/server/Windows/cli/wfreerdp.h
@@ -17,9 +17,9 @@
* limitations under the License.
*/
-#ifndef WFREERDP_H
-#define WFREERDP_H
+#ifndef FREERDP_SERVER_WIN_FREERDP_H
+#define FREERDP_SERVER_WIN_FREERDP_H
#include <freerdp/freerdp.h>
-#endif /* WFREERDP_H */
+#endif /* FREERDP_SERVER_WIN_FREERDP_H */
diff --git a/server/Windows/wf_directsound.h b/server/Windows/wf_directsound.h
index 9e51b27d2..01c1bdd20 100644
--- a/server/Windows/wf_directsound.h
+++ b/server/Windows/wf_directsound.h
@@ -1,5 +1,5 @@
-#ifndef WF_DSOUND_H
-#define WF_DSOUND_H
+#ifndef FREERDP_SERVER_WIN_DSOUND_H
+#define FREERDP_SERVER_WIN_DSOUND_H
#include <freerdp/server/rdpsnd.h>
#include "wf_interface.h"
@@ -10,4 +10,4 @@ int wf_directsound_activate(RdpsndServerContext* context);
DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam);
-#endif \ No newline at end of file
+#endif /* FREERDP_SERVER_WIN_DSOUND_H */
diff --git a/server/Windows/wf_dxgi.h b/server/Windows/wf_dxgi.h
index 1f47ee3a8..3feaa24c5 100644
--- a/server/Windows/wf_dxgi.h
+++ b/server/Windows/wf_dxgi.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef WF_DXGI_H
-#define WF_DXGI_H
+#ifndef FREERDP_SERVER_WIN_DXGI_H
+#define FREERDP_SERVER_WIN_DXGI_H
#include "wf_interface.h"
@@ -39,4 +39,4 @@ int wf_dxgi_releasePixelData(wfInfo* context);
int wf_dxgi_getInvalidRegion(RECT* invalid);
-#endif
+#endif /* FREERDP_SERVER_WIN_DXGI_H */
diff --git a/server/Windows/wf_info.h b/server/Windows/wf_info.h
index 14ea6ea5c..affa7e827 100644
--- a/server/Windows/wf_info.h
+++ b/server/Windows/wf_info.h
@@ -17,13 +17,13 @@
* limitations under the License.
*/
-#ifndef WF_INFO_H
-#define WF_INFO_H
+#ifndef FREERDP_SERVER_WIN_INFO_H
+#define FREERDP_SERVER_WIN_INFO_H
#include "wf_interface.h"
-#define WF_INFO_DEFAULT_FPS 24
-#define WF_INFO_MAXPEERS 32
+#define FREERDP_SERVER_WIN_INFO_DEFAULT_FPS 24
+#define FREERDP_SERVER_WIN_INFO_MAXPEERS 32
BOOL wf_info_lock(wfInfo* wfi);
BOOL wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds);
@@ -42,4 +42,4 @@ BOOL wf_info_have_invalid_region(wfInfo* wfi);
void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, BYTE** pBits, int* pitch);
BOOL CALLBACK wf_info_monEnumCB(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
-#endif /* WF_INFO_H */
+#endif /* FREERDP_SERVER_WIN_INFO_H */
diff --git a/server/Windows/wf_input.h b/server/Windows/wf_input.h
index d185f2bf9..a7b98709a 100644
--- a/server/Windows/wf_input.h
+++ b/server/Windows/wf_input.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef WF_INPUT_H
-#define WF_INPUT_H
+#ifndef FREERDP_SERVER_WIN_INPUT_H
+#define FREERDP_SERVER_WIN_INPUT_H
#include "wf_interface.h"
@@ -33,4 +33,4 @@ void wf_peer_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16
void wf_peer_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
void wf_peer_extended_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
-#endif /* WF_INPUT_H */
+#endif /* FREERDP_SERVER_WIN_INPUT_H */
diff --git a/server/Windows/wf_interface.h b/server/Windows/wf_interface.h
index 6ab6b6f3e..1fbe223ae 100644
--- a/server/Windows/wf_interface.h
+++ b/server/Windows/wf_interface.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef WF_INTERFACE_H
-#define WF_INTERFACE_H
+#ifndef FREERDP_SERVER_WIN_INTERFACE_H
+#define FREERDP_SERVER_WIN_INTERFACE_H
#include <winpr/windows.h>
@@ -36,10 +36,10 @@
#define WITH_DXGI_1_2 1
#endif
-#define WF_SRV_CALLBACK_EVENT_CONNECT 1
-#define WF_SRV_CALLBACK_EVENT_DISCONNECT 2
-#define WF_SRV_CALLBACK_EVENT_ACTIVATE 4
-#define WF_SRV_CALLBACK_EVENT_AUTH 8
+#define FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_CONNECT 1
+#define FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_DISCONNECT 2
+#define FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_ACTIVATE 4
+#define FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_AUTH 8
typedef struct wf_info wfInfo;
typedef struct wf_peer_context wfPeerContext;
@@ -137,4 +137,4 @@ FREERDP_API void wfreerdp_server_register_callback_event(cbCallback cb);
void wfreerdp_server_peer_callback_event(int pId, UINT32 eType);
-#endif /* WF_INTERFACE_H */
+#endif /* FREERDP_SERVER_WIN_INTERFACE_H */
diff --git a/server/Windows/wf_mirage.h b/server/Windows/wf_mirage.h
index 372e02bbe..b88971871 100644
--- a/server/Windows/wf_mirage.h
+++ b/server/Windows/wf_mirage.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef WF_MIRAGE_H
-#define WF_MIRAGE_H
+#ifndef FREERDP_SERVER_WIN_MIRAGE_H
+#define FREERDP_SERVER_WIN_MIRAGE_H
#include "wf_interface.h"
@@ -218,4 +218,4 @@ BOOL wf_mirror_driver_cleanup(wfInfo* wfi);
BOOL wf_mirror_driver_activate(wfInfo* wfi);
void wf_mirror_driver_deactivate(wfInfo* wfi);
-#endif /* WF_MIRAGE_H */
+#endif /* FREERDP_SERVER_WIN_MIRAGE_H */
diff --git a/server/Windows/wf_peer.h b/server/Windows/wf_peer.h
index 7d8f1d0ea..0abbb5a18 100644
--- a/server/Windows/wf_peer.h
+++ b/server/Windows/wf_peer.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef WF_PEER_H
-#define WF_PEER_H
+#ifndef FREERDP_SERVER_WIN_PEER_H
+#define FREERDP_SERVER_WIN_PEER_H
#include "wf_interface.h"
@@ -48,4 +48,4 @@ BOOL wf_peer_accepted(freerdp_listener* instance, freerdp_peer* client);
DWORD WINAPI wf_peer_main_loop(LPVOID lpParam);
-#endif /* WF_PEER_H */
+#endif /* FREERDP_SERVER_WIN_PEER_H */
diff --git a/server/Windows/wf_rdpsnd.h b/server/Windows/wf_rdpsnd.h
index c61de61b9..9a82664e2 100644
--- a/server/Windows/wf_rdpsnd.h
+++ b/server/Windows/wf_rdpsnd.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef WF_RDPSND_H
-#define WF_RDPSND_H
+#ifndef FREERDP_SERVER_WIN_RDPSND_H
+#define FREERDP_SERVER_WIN_RDPSND_H
#include <freerdp/freerdp.h>
#include <freerdp/listener.h>
@@ -31,5 +31,5 @@ int wf_rdpsnd_unlock(void);
BOOL wf_peer_rdpsnd_init(wfPeerContext* context);
-#endif /* WF_RDPSND_H */
+#endif /* FREERDP_SERVER_WIN_RDPSND_H */
diff --git a/server/Windows/wf_settings.h b/server/Windows/wf_settings.h
index 205ab97e0..40e25aa2b 100644
--- a/server/Windows/wf_settings.h
+++ b/server/Windows/wf_settings.h
@@ -17,12 +17,12 @@
* limitations under the License.
*/
-#ifndef WF_SETTINGS_H
-#define WF_SETTINGS_H
+#ifndef FREERDP_SERVER_WIN_SETTINGS_H
+#define FREERDP_SERVER_WIN_SETTINGS_H
#include "wf_interface.h"
BOOL wf_settings_read_dword(HKEY key, LPCSTR subkey, LPTSTR name, DWORD* value);
BOOL wf_settings_read_string_ascii(HKEY key, LPCSTR subkey, LPTSTR name, char** value);
-#endif /* WF_SETTINGS_H */
+#endif /* FREERDP_SERVER_WIN_SETTINGS_H */
diff --git a/server/Windows/wf_update.h b/server/Windows/wf_update.h
index 0fb9c46bd..47553aff0 100644
--- a/server/Windows/wf_update.h
+++ b/server/Windows/wf_update.h
@@ -17,8 +17,8 @@
* limitations under the License.
*/
-#ifndef WF_UPDATE_H
-#define WF_UPDATE_H
+#ifndef FREERDP_SERVER_WIN_UPDATE_H
+#define FREERDP_SERVER_WIN_UPDATE_H
#include "wf_interface.h"
@@ -34,4 +34,4 @@ void wf_update_end(wfInfo* wfi);
void wf_update_peer_activate(wfInfo* wfi, wfPeerContext* context);
void wf_update_peer_deactivate(wfInfo* wfi, wfPeerContext* context);
-#endif /* WF_UPDATE_H */
+#endif /* FREERDP_SERVER_WIN_UPDATE_H */
diff --git a/server/Windows/wf_wasapi.c b/server/Windows/wf_wasapi.c
index b37c4d2a8..1855e4cd5 100644
--- a/server/Windows/wf_wasapi.c
+++ b/server/Windows/wf_wasapi.c
@@ -133,7 +133,7 @@ int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR * deviceStr)
WLog_INFO(TAG, "Using sound ouput endpoint: [%s] (%s)", nameVar.pwszVal, pwszID);
//WLog_INFO(TAG, "matched %d characters", wcscmp(pattern, nameVar.pwszVal);
devStrLen = wcslen(pwszID);
- *deviceStr = (LPWSTR) calloc(1, (devStrLen * 2) + 2);
+ *deviceStr = (LPWSTR) calloc(devStrLen + 1, 2);
if (!deviceStr)
return -1;
wcscpy_s(*deviceStr, devStrLen+1, pwszID);
diff --git a/server/Windows/wf_wasapi.h b/server/Windows/wf_wasapi.h
index 7461f2a0d..303b4f9b2 100644
--- a/server/Windows/wf_wasapi.h
+++ b/server/Windows/wf_wasapi.h
@@ -1,5 +1,5 @@
-#ifndef WF_WASAPI_H
-#define WF_WASAPI_H
+#ifndef FREERDP_SERVER_WIN_WASAPI_H
+#define FREERDP_SERVER_WIN_WASAPI_H
#include <freerdp/server/rdpsnd.h>
#include "wf_interface.h"
@@ -12,4 +12,4 @@ int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR * deviceStr);
DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam);
-#endif \ No newline at end of file
+#endif /* FREERDP_SERVER_WIN_WASAPI_H */
diff --git a/server/shadow/Mac/mac_shadow.h b/server/shadow/Mac/mac_shadow.h
index dc5d24b2d..dff555e17 100644
--- a/server/shadow/Mac/mac_shadow.h
+++ b/server/shadow/Mac/mac_shadow.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_MAC_H
-#define FREERDP_SHADOW_SERVER_MAC_H
+#ifndef FREERDP_SERVER_SHADOW_MAC_SHADOW_H
+#define FREERDP_SERVER_SHADOW_MAC_SHADOW_H
#include <freerdp/server/shadow.h>
@@ -62,4 +62,4 @@ extern "C" {
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_MAC_H */
+#endif /* FREERDP_SERVER_SHADOW_MAC_SHADOW_H */
diff --git a/server/shadow/Win/win_dxgi.h b/server/shadow/Win/win_dxgi.h
index 1dcdf7ac8..92b208984 100644
--- a/server/shadow/Win/win_dxgi.h
+++ b/server/shadow/Win/win_dxgi.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_WIN_DXGI_H
-#define FREERDP_SHADOW_SERVER_WIN_DXGI_H
+#ifndef FREERDP_SERVER_SHADOW_WIN_DXGI_H
+#define FREERDP_SERVER_SHADOW_WIN_DXGI_H
#if _WIN32_WINNT >= 0x0602
//#define WITH_DXGI_1_2 1
@@ -57,4 +57,4 @@ int win_shadow_dxgi_get_invalid_region(winShadowSubsystem* subsystem);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_WIN_DXGI_H */
+#endif /* FREERDP_SERVER_SHADOW_WIN_DXGI_H */
diff --git a/server/shadow/Win/win_rdp.h b/server/shadow/Win/win_rdp.h
index e48d46e6b..bc6b1a185 100644
--- a/server/shadow/Win/win_rdp.h
+++ b/server/shadow/Win/win_rdp.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_WIN_RDP_H
-#define FREERDP_SHADOW_SERVER_WIN_RDP_H
+#ifndef FREERDP_SERVER_SHADOW_WIN_RDP_H
+#define FREERDP_SERVER_SHADOW_WIN_RDP_H
#include <freerdp/addin.h>
#include <freerdp/gdi/gdi.h>
@@ -53,4 +53,4 @@ int win_shadow_rdp_stop(winShadowSubsystem* subsystem);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_WIN_RDP_H */
+#endif /* FREERDP_SERVER_SHADOW_WIN_RDP_H */
diff --git a/server/shadow/Win/win_shadow.h b/server/shadow/Win/win_shadow.h
index c403bd6f1..2ce22f1ee 100644
--- a/server/shadow/Win/win_shadow.h
+++ b/server/shadow/Win/win_shadow.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_WIN_H
-#define FREERDP_SHADOW_SERVER_WIN_H
+#ifndef FREERDP_SERVER_SHADOW_WIN_H
+#define FREERDP_SERVER_SHADOW_WIN_H
#include <freerdp/assistance.h>
@@ -87,4 +87,4 @@ extern "C" {
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_WIN_H */
+#endif /* FREERDP_SERVER_SHADOW_WIN_H */
diff --git a/server/shadow/Win/win_wds.h b/server/shadow/Win/win_wds.h
index d8859d706..8262e8515 100644
--- a/server/shadow/Win/win_wds.h
+++ b/server/shadow/Win/win_wds.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_WIN_WDS_H
-#define FREERDP_SHADOW_SERVER_WIN_WDS_H
+#ifndef FREERDP_SERVER_SHADOW_WIN_WDS_H
+#define FREERDP_SERVER_SHADOW_WIN_WDS_H
#define WITH_WDS_API 1
@@ -44,4 +44,4 @@ int win_shadow_wds_uninit(winShadowSubsystem* subsystem);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_WIN_WDS_H */
+#endif /* FREERDP_SERVER_SHADOW_WIN_WDS_H */
diff --git a/server/shadow/X11/x11_shadow.c b/server/shadow/X11/x11_shadow.c
index 9c7505318..2a3f8900b 100644
--- a/server/shadow/X11/x11_shadow.c
+++ b/server/shadow/X11/x11_shadow.c
@@ -46,7 +46,7 @@
#define TAG SERVER_TAG("shadow.x11")
-static int x11_shadow_enum_monitors(MONITOR_DEF* monitors, int maxMonitors);
+static UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors);
#ifdef WITH_PAM
@@ -591,6 +591,10 @@ static int x11_shadow_blend_cursor(x11ShadowSubsystem* subsystem)
BYTE* pDstData;
BYTE A, R, G, B;
rdpShadowSurface* surface;
+
+ if (!subsystem)
+ return -1;
+
surface = subsystem->server->surface;
nXSrc = 0;
nYSrc = 0;
@@ -1102,7 +1106,7 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
return 1;
}
-int x11_shadow_enum_monitors(MONITOR_DEF* monitors, int maxMonitors)
+UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
{
int index;
Display* display;
@@ -1175,7 +1179,7 @@ int x11_shadow_enum_monitors(MONITOR_DEF* monitors, int maxMonitors)
return numMonitors;
}
-static int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
+static int x11_shadow_subsystem_init(rdpShadowSubsystem* sub)
{
int i;
int pf_count;
@@ -1188,6 +1192,11 @@ static int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
XPixmapFormatValues* pf;
XPixmapFormatValues* pfs;
MONITOR_DEF* virtualScreen;
+ x11ShadowSubsystem* subsystem = (x11ShadowSubsystem*)sub;
+
+ if (!subsystem)
+ return -1;
+
subsystem->numMonitors = x11_shadow_enum_monitors(subsystem->monitors, 16);
x11_shadow_subsystem_base_init(subsystem);
@@ -1311,8 +1320,10 @@ static int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
return 1;
}
-static int x11_shadow_subsystem_uninit(x11ShadowSubsystem* subsystem)
+static int x11_shadow_subsystem_uninit(rdpShadowSubsystem* sub)
{
+ x11ShadowSubsystem* subsystem = (x11ShadowSubsystem*)sub;
+
if (!subsystem)
return -1;
@@ -1337,10 +1348,12 @@ static int x11_shadow_subsystem_uninit(x11ShadowSubsystem* subsystem)
return 1;
}
-static int x11_shadow_subsystem_start(x11ShadowSubsystem* subsystem)
+static int x11_shadow_subsystem_start(rdpShadowSubsystem* sub)
{
- if (!subsystem)
- return -1;
+ x11ShadowSubsystem* subsystem = (x11ShadowSubsystem*)sub;
+
+ if (!subsystem)
+ return -1;
if (!(subsystem->thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) x11_shadow_subsystem_thread,
@@ -1353,10 +1366,12 @@ static int x11_shadow_subsystem_start(x11ShadowSubsystem* subsystem)
return 1;
}
-static int x11_shadow_subsystem_stop(x11ShadowSubsystem* subsystem)
+static int x11_shadow_subsystem_stop(rdpShadowSubsystem* sub)
{
- if (!subsystem)
- return -1;
+ x11ShadowSubsystem* subsystem = (x11ShadowSubsystem*)sub;
+
+ if (!subsystem)
+ return -1;
if (subsystem->thread)
{
@@ -1370,7 +1385,7 @@ static int x11_shadow_subsystem_stop(x11ShadowSubsystem* subsystem)
return 1;
}
-static x11ShadowSubsystem* x11_shadow_subsystem_new(void)
+static rdpShadowSubsystem* x11_shadow_subsystem_new(void)
{
x11ShadowSubsystem* subsystem;
subsystem = (x11ShadowSubsystem*) calloc(1, sizeof(x11ShadowSubsystem));
@@ -1395,10 +1410,10 @@ static x11ShadowSubsystem* x11_shadow_subsystem_new(void)
subsystem->use_xfixes = TRUE;
subsystem->use_xdamage = FALSE;
subsystem->use_xinerama = TRUE;
- return subsystem;
+ return (rdpShadowSubsystem*)subsystem;
}
-static void x11_shadow_subsystem_free(x11ShadowSubsystem* subsystem)
+static void x11_shadow_subsystem_free(rdpShadowSubsystem* subsystem)
{
if (!subsystem)
return;
@@ -1409,12 +1424,15 @@ static void x11_shadow_subsystem_free(x11ShadowSubsystem* subsystem)
FREERDP_API int X11_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
{
- pEntryPoints->New = (pfnShadowSubsystemNew) x11_shadow_subsystem_new;
- pEntryPoints->Free = (pfnShadowSubsystemFree) x11_shadow_subsystem_free;
- pEntryPoints->Init = (pfnShadowSubsystemInit) x11_shadow_subsystem_init;
- pEntryPoints->Uninit = (pfnShadowSubsystemInit) x11_shadow_subsystem_uninit;
- pEntryPoints->Start = (pfnShadowSubsystemStart) x11_shadow_subsystem_start;
- pEntryPoints->Stop = (pfnShadowSubsystemStop) x11_shadow_subsystem_stop;
- pEntryPoints->EnumMonitors = (pfnShadowEnumMonitors) x11_shadow_enum_monitors;
+ if (!pEntryPoints)
+ return -1;
+
+ pEntryPoints->New = x11_shadow_subsystem_new;
+ pEntryPoints->Free = x11_shadow_subsystem_free;
+ pEntryPoints->Init = x11_shadow_subsystem_init;
+ pEntryPoints->Uninit = x11_shadow_subsystem_uninit;
+ pEntryPoints->Start = x11_shadow_subsystem_start;
+ pEntryPoints->Stop = x11_shadow_subsystem_stop;
+ pEntryPoints->EnumMonitors = x11_shadow_enum_monitors;
return 1;
}
diff --git a/server/shadow/X11/x11_shadow.h b/server/shadow/X11/x11_shadow.h
index 5425bf2fe..e6e361e37 100644
--- a/server/shadow/X11/x11_shadow.h
+++ b/server/shadow/X11/x11_shadow.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_X11_H
-#define FREERDP_SHADOW_SERVER_X11_H
+#ifndef FREERDP_SERVER_SHADOW_X11_H
+#define FREERDP_SERVER_SHADOW_X11_H
#include <freerdp/server/shadow.h>
@@ -57,17 +57,17 @@ struct x11_shadow_subsystem
HANDLE thread;
- int bpp;
+ UINT32 bpp;
int xfds;
- int depth;
- int width;
- int height;
+ UINT32 depth;
+ UINT32 width;
+ UINT32 height;
int number;
XImage* image;
Screen* screen;
Visual* visual;
Display* display;
- int scanline_pad;
+ UINT32 scanline_pad;
BOOL composite;
BOOL use_xshm;
@@ -80,14 +80,14 @@ struct x11_shadow_subsystem
Window root_window;
XShmSegmentInfo fb_shm_info;
- int cursorHotX;
- int cursorHotY;
- int cursorWidth;
- int cursorHeight;
+ UINT32 cursorHotX;
+ UINT32 cursorHotY;
+ UINT32 cursorWidth;
+ UINT32 cursorHeight;
UINT32 cursorId;
BYTE* cursorPixels;
- int cursorMaxWidth;
- int cursorMaxHeight;
+ UINT32 cursorMaxWidth;
+ UINT32 cursorMaxHeight;
rdpShadowClient* lastMouseClient;
#ifdef WITH_XDAMAGE
@@ -112,4 +112,4 @@ extern "C" {
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_X11_H */
+#endif /* FREERDP_SERVER_SHADOW_X11_H */
diff --git a/server/shadow/shadow.h b/server/shadow/shadow.h
index b41449d1c..2532bfd41 100644
--- a/server/shadow/shadow.h
+++ b/server/shadow/shadow.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_H
-#define FREERDP_SHADOW_SERVER_H
+#ifndef FREERDP_SERVER_SHADOW_SHADOW_H
+#define FREERDP_SERVER_SHADOW_SHADOW_H
#include <freerdp/server/shadow.h>
@@ -42,5 +42,5 @@ extern "C" {
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_H */
+#endif /* FREERDP_SERVER_SHADOW_SHADOW_H */
diff --git a/server/shadow/shadow_audin.h b/server/shadow/shadow_audin.h
index a02bd3b4e..5bc6252a7 100644
--- a/server/shadow/shadow_audin.h
+++ b/server/shadow/shadow_audin.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_AUDIN_H
-#define FREERDP_SHADOW_SERVER_AUDIN_H
+#ifndef FREERDP_SERVER_SHADOW_AUDIN_H
+#define FREERDP_SERVER_SHADOW_AUDIN_H
#include <freerdp/server/shadow.h>
@@ -35,4 +35,4 @@ void shadow_client_audin_uninit(rdpShadowClient* client);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_AUDIN_H */
+#endif /* FREERDP_SERVER_SHADOW_AUDIN_H */
diff --git a/server/shadow/shadow_capture.c b/server/shadow/shadow_capture.c
index dbf0ae6dc..18c33b984 100644
--- a/server/shadow/shadow_capture.c
+++ b/server/shadow/shadow_capture.c
@@ -80,14 +80,15 @@ int shadow_capture_align_clip_rect(RECTANGLE_16* rect, RECTANGLE_16* clip)
return 1;
}
-int shadow_capture_compare(BYTE* pData1, int nStep1, int nWidth, int nHeight, BYTE* pData2, int nStep2, RECTANGLE_16* rect)
+int shadow_capture_compare(BYTE* pData1, UINT32 nStep1, UINT32 nWidth, UINT32 nHeight,
+ BYTE* pData2, UINT32 nStep2, RECTANGLE_16* rect)
{
BOOL equal;
BOOL allEqual;
- int tw, th;
- int tx, ty, k;
- int nrow, ncol;
- int l, t, r, b;
+ UINT32 tw, th;
+ UINT32 tx, ty, k;
+ UINT32 nrow, ncol;
+ UINT32 l, t, r, b;
BYTE *p1, *p2;
BOOL rows[1024];
#ifdef WITH_DEBUG_SHADOW_CAPTURE
@@ -105,10 +106,10 @@ int shadow_capture_compare(BYTE* pData1, int nStep1, int nWidth, int nHeight, BY
ncol = (nWidth + 15) / 16;
l = ncol + 1;
- r = -1;
+ r = 0;
t = nrow + 1;
- b = -1;
+ b = 0;
for (ty = 0; ty < nrow; ty++)
{
diff --git a/server/shadow/shadow_capture.h b/server/shadow/shadow_capture.h
index f5e7404c5..2989ff883 100644
--- a/server/shadow/shadow_capture.h
+++ b/server/shadow/shadow_capture.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_CAPTURE_H
-#define FREERDP_SHADOW_SERVER_CAPTURE_H
+#ifndef FREERDP_SERVER_SHADOW_CAPTURE_H
+#define FREERDP_SERVER_SHADOW_CAPTURE_H
#include <freerdp/server/shadow.h>
@@ -45,4 +45,4 @@ void shadow_capture_free(rdpShadowCapture* capture);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_CAPTURE_H */
+#endif /* FREERDP_SERVER_SHADOW_CAPTURE_H */
diff --git a/server/shadow/shadow_channels.h b/server/shadow/shadow_channels.h
index e35b6f6ee..cdd739f1d 100644
--- a/server/shadow/shadow_channels.h
+++ b/server/shadow/shadow_channels.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_CHANNELS_H
-#define FREERDP_SHADOW_SERVER_CHANNELS_H
+#ifndef FREERDP_SERVER_SHADOW_CHANNELS_H
+#define FREERDP_SERVER_SHADOW_CHANNELS_H
#include <freerdp/server/shadow.h>
@@ -41,4 +41,4 @@ void shadow_client_channels_free(rdpShadowClient* client);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_CHANNELS_H */
+#endif /* FREERDP_SERVER_SHADOW_CHANNELS_H */
diff --git a/server/shadow/shadow_client.c b/server/shadow/shadow_client.c
index d4a194756..08a133182 100644
--- a/server/shadow/shadow_client.c
+++ b/server/shadow/shadow_client.c
@@ -1067,8 +1067,7 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client,
totalBitmapSize = 0;
bitmapUpdate.count = bitmapUpdate.number = rows * cols;
- if (!(bitmapData = (BITMAP_DATA*) malloc(sizeof(BITMAP_DATA) *
- bitmapUpdate.number)))
+ if (!(bitmapData = (BITMAP_DATA*) calloc(bitmapUpdate.number, sizeof(BITMAP_DATA))))
return FALSE;
bitmapUpdate.rectangles = bitmapData;
@@ -1154,7 +1153,7 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client,
BITMAP_DATA* fragBitmapData = NULL;
if (k > 0)
- fragBitmapData = (BITMAP_DATA*) malloc(sizeof(BITMAP_DATA) * k);
+ fragBitmapData = (BITMAP_DATA*) calloc(k, sizeof(BITMAP_DATA));
if (!fragBitmapData)
{
diff --git a/server/shadow/shadow_client.h b/server/shadow/shadow_client.h
index 789dde5cc..e61b4513b 100644
--- a/server/shadow/shadow_client.h
+++ b/server/shadow/shadow_client.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_CLIENT_H
-#define FREERDP_SHADOW_SERVER_CLIENT_H
+#ifndef FREERDP_SERVER_SHADOW_CLIENT_H
+#define FREERDP_SERVER_SHADOW_CLIENT_H
#include <freerdp/server/shadow.h>
@@ -32,4 +32,4 @@ BOOL shadow_client_accepted(freerdp_listener* instance, freerdp_peer* client);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_CLIENT_H */
+#endif /* FREERDP_SERVER_SHADOW_CLIENT_H */
diff --git a/server/shadow/shadow_encoder.c b/server/shadow/shadow_encoder.c
index b9d1cb55b..5d9218492 100644
--- a/server/shadow/shadow_encoder.c
+++ b/server/shadow/shadow_encoder.c
@@ -86,12 +86,12 @@ static int shadow_encoder_init_grid(rdpShadowEncoder* encoder)
encoder->maxTileHeight);
tileSize = encoder->maxTileWidth * encoder->maxTileHeight * 4;
tileCount = encoder->gridWidth * encoder->gridHeight;
- encoder->gridBuffer = (BYTE*) malloc(tileSize * tileCount);
+ encoder->gridBuffer = (BYTE*) calloc(tileSize, tileCount);
if (!encoder->gridBuffer)
return -1;
- encoder->grid = (BYTE**) malloc(tileCount * sizeof(BYTE*));
+ encoder->grid = (BYTE**) calloc(tileCount, sizeof(BYTE*));
if (!encoder->grid)
return -1;
diff --git a/server/shadow/shadow_encoder.h b/server/shadow/shadow_encoder.h
index 611850d1d..0299a4b5c 100644
--- a/server/shadow/shadow_encoder.h
+++ b/server/shadow/shadow_encoder.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_ENCODER_H
-#define FREERDP_SHADOW_SERVER_ENCODER_H
+#ifndef FREERDP_SERVER_SHADOW_ENCODER_H
+#define FREERDP_SERVER_SHADOW_ENCODER_H
#include <winpr/crt.h>
#include <winpr/stream.h>
@@ -74,4 +74,4 @@ void shadow_encoder_free(rdpShadowEncoder* encoder);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_ENCODER_H */
+#endif /* FREERDP_SERVER_SHADOW_ENCODER_H */
diff --git a/server/shadow/shadow_encomsp.h b/server/shadow/shadow_encomsp.h
index c154dc9ab..4e7d80604 100644
--- a/server/shadow/shadow_encomsp.h
+++ b/server/shadow/shadow_encomsp.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_ENCOMSP_H
-#define FREERDP_SHADOW_SERVER_ENCOMSP_H
+#ifndef FREERDP_SERVER_SHADOW_ENCOMSP_H
+#define FREERDP_SERVER_SHADOW_ENCOMSP_H
#include <freerdp/server/shadow.h>
@@ -35,4 +35,4 @@ void shadow_client_encomsp_uninit(rdpShadowClient* client);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_ENCOMSP_H */
+#endif /* FREERDP_SERVER_SHADOW_ENCOMSP_H */
diff --git a/server/shadow/shadow_input.h b/server/shadow/shadow_input.h
index cc87ffc6e..95ed4da74 100644
--- a/server/shadow/shadow_input.h
+++ b/server/shadow/shadow_input.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_INPUT_H
-#define FREERDP_SHADOW_SERVER_INPUT_H
+#ifndef FREERDP_SERVER_SHADOW_INPUT_H
+#define FREERDP_SERVER_SHADOW_INPUT_H
#include <freerdp/server/shadow.h>
@@ -31,4 +31,4 @@ void shadow_input_register_callbacks(rdpInput* input);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_INPUT_H */
+#endif /* FREERDP_SERVER_SHADOW_INPUT_H */
diff --git a/server/shadow/shadow_lobby.h b/server/shadow/shadow_lobby.h
index c3aa68156..6c308e6e8 100644
--- a/server/shadow/shadow_lobby.h
+++ b/server/shadow/shadow_lobby.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_LOBBY_H
-#define FREERDP_SHADOW_SERVER_LOBBY_H
+#ifndef FREERDP_SERVER_SHADOW_LOBBY_H
+#define FREERDP_SERVER_SHADOW_LOBBY_H
#include <freerdp/server/shadow.h>
@@ -36,4 +36,4 @@ BOOL shadow_client_init_lobby(rdpShadowServer* server);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_LOBBY_H */
+#endif /* FREERDP_SERVER_SHADOW_LOBBY_H */
diff --git a/server/shadow/shadow_mcevent.h b/server/shadow/shadow_mcevent.h
index d604700a4..d6f4dab64 100644
--- a/server/shadow/shadow_mcevent.h
+++ b/server/shadow/shadow_mcevent.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_MCEVENT_H
-#define FREERDP_SHADOW_SERVER_MCEVENT_H
+#ifndef FREERDP_SERVER_SHADOW_MCEVENT_H
+#define FREERDP_SERVER_SHADOW_MCEVENT_H
#include <freerdp/server/shadow.h>
@@ -62,4 +62,4 @@ HANDLE shadow_multiclient_getevent(void* subscriber);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_MCEVENT_H */
+#endif /* FREERDP_SERVER_SHADOW_MCEVENT_H */
diff --git a/server/shadow/shadow_rdpgfx.h b/server/shadow/shadow_rdpgfx.h
index 0ac810d74..36af7572c 100644
--- a/server/shadow/shadow_rdpgfx.h
+++ b/server/shadow/shadow_rdpgfx.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_RDPGFX_H
-#define FREERDP_SHADOW_SERVER_RDPGFX_H
+#ifndef FREERDP_SERVER_SHADOW_RDPGFX_H
+#define FREERDP_SERVER_SHADOW_RDPGFX_H
#include <freerdp/server/shadow.h>
@@ -35,4 +35,4 @@ void shadow_client_rdpgfx_uninit(rdpShadowClient* client);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_RDPGFX_H */
+#endif /* FREERDP_SERVER_SHADOW_RDPGFX_H */
diff --git a/server/shadow/shadow_rdpsnd.h b/server/shadow/shadow_rdpsnd.h
index b95e9ce3b..c5e60b219 100644
--- a/server/shadow/shadow_rdpsnd.h
+++ b/server/shadow/shadow_rdpsnd.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_RDPSND_H
-#define FREERDP_SHADOW_SERVER_RDPSND_H
+#ifndef FREERDP_SERVER_SHADOW_RDPSND_H
+#define FREERDP_SERVER_SHADOW_RDPSND_H
#include <freerdp/server/shadow.h>
@@ -35,4 +35,4 @@ void shadow_client_rdpsnd_uninit(rdpShadowClient* client);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_RDPSND_H */
+#endif /* FREERDP_SERVER_SHADOW_RDPSND_H */
diff --git a/server/shadow/shadow_remdesk.h b/server/shadow/shadow_remdesk.h
index 78779ab35..953289377 100644
--- a/server/shadow/shadow_remdesk.h
+++ b/server/shadow/shadow_remdesk.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_REMDESK_H
-#define FREERDP_SHADOW_SERVER_REMDESK_H
+#ifndef FREERDP_SERVER_SHADOW_REMDESK_H
+#define FREERDP_SERVER_SHADOW_REMDESK_H
#include <freerdp/server/shadow.h>
@@ -35,4 +35,4 @@ void shadow_client_remdesk_uninit(rdpShadowClient* client);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_REMDESK_H */
+#endif /* FREERDP_SERVER_SHADOW_REMDESK_H */
diff --git a/server/shadow/shadow_screen.h b/server/shadow/shadow_screen.h
index 806d40fa7..e8f5c1751 100644
--- a/server/shadow/shadow_screen.h
+++ b/server/shadow/shadow_screen.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_SCREEN_H
-#define FREERDP_SHADOW_SERVER_SCREEN_H
+#ifndef FREERDP_SERVER_SHADOW_SCREEN_H
+#define FREERDP_SERVER_SHADOW_SCREEN_H
#include <freerdp/server/shadow.h>
@@ -49,4 +49,4 @@ void shadow_screen_free(rdpShadowScreen* screen);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_SCREEN_H */
+#endif /* FREERDP_SERVER_SHADOW_SCREEN_H */
diff --git a/server/shadow/shadow_subsystem.c b/server/shadow/shadow_subsystem.c
index 7f3173af6..cc5766a1f 100644
--- a/server/shadow/shadow_subsystem.c
+++ b/server/shadow/shadow_subsystem.c
@@ -44,7 +44,7 @@ static int shadow_subsystem_load_entry_points(RDP_SHADOW_ENTRY_POINTS* pEntryPoi
return 1;
}
-rdpShadowSubsystem* shadow_subsystem_new()
+rdpShadowSubsystem* shadow_subsystem_new(void)
{
RDP_SHADOW_ENTRY_POINTS ep;
rdpShadowSubsystem* subsystem = NULL;
@@ -165,9 +165,9 @@ int shadow_subsystem_stop(rdpShadowSubsystem* subsystem)
return status;
}
-int shadow_enum_monitors(MONITOR_DEF* monitors, int maxMonitors)
+UINT32 shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
{
- int numMonitors = 0;
+ UINT32 numMonitors = 0;
RDP_SHADOW_ENTRY_POINTS ep;
if (shadow_subsystem_load_entry_points(&ep) < 0)
diff --git a/server/shadow/shadow_subsystem.h b/server/shadow/shadow_subsystem.h
index 7170cf207..ef8d7ef92 100644
--- a/server/shadow/shadow_subsystem.h
+++ b/server/shadow/shadow_subsystem.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_SUBSYSTEM_H
-#define FREERDP_SHADOW_SERVER_SUBSYSTEM_H
+#ifndef FREERDP_SERVER_SHADOW_SUBSYSTEM_H
+#define FREERDP_SERVER_SHADOW_SUBSYSTEM_H
#include <freerdp/server/shadow.h>
@@ -28,7 +28,7 @@
extern "C" {
#endif
-rdpShadowSubsystem* shadow_subsystem_new();
+rdpShadowSubsystem* shadow_subsystem_new(void);
void shadow_subsystem_free(rdpShadowSubsystem* subsystem);
int shadow_subsystem_init(rdpShadowSubsystem* subsystem, rdpShadowServer* server);
@@ -41,5 +41,5 @@ int shadow_subsystem_stop(rdpShadowSubsystem* subsystem);
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_SUBSYSTEM_H */
+#endif /* FREERDP_SERVER_SHADOW_SUBSYSTEM_H */
diff --git a/server/shadow/shadow_surface.c b/server/shadow/shadow_surface.c
index e3d1f8c0a..78d31a77b 100644
--- a/server/shadow/shadow_surface.c
+++ b/server/shadow/shadow_surface.c
@@ -40,8 +40,8 @@ rdpShadowSurface* shadow_surface_new(rdpShadowServer* server, int x, int y,
surface->height = height;
surface->scanline = ALIGN_SCREEN_SIZE(surface->width, 4) * 4;
surface->format = PIXEL_FORMAT_BGRX32;
- surface->data = (BYTE*) calloc(1,
- surface->scanline * ALIGN_SCREEN_SIZE(surface->height, 4));
+ surface->data = (BYTE*) calloc(ALIGN_SCREEN_SIZE(surface->height, 4),
+ surface->scanline);
if (!surface->data)
{
diff --git a/server/shadow/shadow_surface.h b/server/shadow/shadow_surface.h
index 2eefe5e33..abfbd562b 100644
--- a/server/shadow/shadow_surface.h
+++ b/server/shadow/shadow_surface.h
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-#ifndef FREERDP_SHADOW_SERVER_SURFACE_H
-#define FREERDP_SHADOW_SERVER_SURFACE_H
+#ifndef FREERDP_SERVER_SHADOW_SURFACE_H
+#define FREERDP_SERVER_SHADOW_SURFACE_H
#include <freerdp/server/shadow.h>
@@ -36,4 +36,4 @@ BOOL shadow_surface_resize(rdpShadowSurface *surface, int x, int y, int width, i
}
#endif
-#endif /* FREERDP_SHADOW_SERVER_SURFACE_H */
+#endif /* FREERDP_SERVER_SHADOW_SURFACE_H */
diff --git a/uwac/include/uwac/uwac-tools.h b/uwac/include/uwac/uwac-tools.h
index 07813fbd5..859e51dde 100644
--- a/uwac/include/uwac/uwac-tools.h
+++ b/uwac/include/uwac/uwac-tools.h
@@ -20,8 +20,8 @@
* OF THIS SOFTWARE.
*/
-#ifndef __UWAC_TOOLS_H_
-#define __UWAC_TOOLS_H_
+#ifndef UWAC_TOOLS_H_
+#define UWAC_TOOLS_H_
#include <stdbool.h>
#include <uwac/uwac.h>
@@ -57,4 +57,4 @@ UWAC_API void UwacTouchAutomataReset(UwacTouchAutomata *automata);
*/
UWAC_API bool UwacTouchAutomataInjectEvent(UwacTouchAutomata *automata, UwacEvent *event);
-#endif /* __UWAC_TOOLS_H_ */
+#endif /* UWAC_TOOLS_H_ */
diff --git a/uwac/include/uwac/uwac.h b/uwac/include/uwac/uwac.h
index fd422f4b5..5042803cc 100644
--- a/uwac/include/uwac/uwac.h
+++ b/uwac/include/uwac/uwac.h
@@ -20,8 +20,8 @@
* OF THIS SOFTWARE.
*/
-#ifndef __UWAC_H_
-#define __UWAC_H_
+#ifndef UWAC_H_
+#define UWAC_H_
#include <wayland-client.h>
#include <stdbool.h>
@@ -483,4 +483,4 @@ UWAC_API const char *UwacSeatGetName(const UwacSeat *seat);
}
#endif
-#endif /* __UWAC_H_ */
+#endif /* UWAC_H_ */
diff --git a/uwac/libuwac/uwac-os.h b/uwac/libuwac/uwac-os.h
index be927df7d..64b582117 100644
--- a/uwac/libuwac/uwac-os.h
+++ b/uwac/libuwac/uwac-os.h
@@ -28,8 +28,8 @@
* Functions have been renamed just to prevent name clashes.
*/
-#ifndef __UWAC_OS_H
-#define __UWAC_OS_H
+#ifndef UWAC_OS_H
+#define UWAC_OS_H
#include <sys/socket.h>
@@ -42,4 +42,4 @@ ssize_t uwac_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags);
int uwac_os_epoll_create_cloexec(void);
int uwac_create_anonymous_file(off_t size);
-#endif /* __UWAC_OS_H */
+#endif /* UWAC_OS_H */
diff --git a/uwac/libuwac/uwac-priv.h b/uwac/libuwac/uwac-priv.h
index 8b0324d23..2a8e16b88 100644
--- a/uwac/libuwac/uwac-priv.h
+++ b/uwac/libuwac/uwac-priv.h
@@ -20,8 +20,8 @@
* OF THIS SOFTWARE.
*/
-#ifndef __UWAC_PRIV_H_
-#define __UWAC_PRIV_H_
+#ifndef UWAC_PRIV_H_
+#define UWAC_PRIV_H_
#include "config.h"
@@ -234,4 +234,4 @@ void UwacSeatDestroy(UwacSeat *s);
UwacOutput *UwacCreateOutput(UwacDisplay *d, uint32_t id, uint32_t version);
int UwacDestroyOutput(UwacOutput *output);
-#endif /* __UWAC_PRIV_H_ */
+#endif /* UWAC_PRIV_H_ */
diff --git a/uwac/libuwac/uwac-utils.h b/uwac/libuwac/uwac-utils.h
index e30507300..bd96bb08c 100644
--- a/uwac/libuwac/uwac-utils.h
+++ b/uwac/libuwac/uwac-utils.h
@@ -20,8 +20,8 @@
* OF THIS SOFTWARE.
*/
-#ifndef __UWAC_UTILS_H_
-#define __UWAC_UTILS_H_
+#ifndef UWAC_UTILS_H_
+#define UWAC_UTILS_H_
#include <stdlib.h>
@@ -50,4 +50,4 @@ char *xstrdup(const char *s);
void *xrealloc(char *p, size_t s);
-#endif /* __UWAC_UTILS_H_ */
+#endif /* UWAC_UTILS_H_ */
diff --git a/winpr/libwinpr/clipboard/clipboard.c b/winpr/libwinpr/clipboard/clipboard.c
index 3b2cb5b92..35956b8bc 100644
--- a/winpr/libwinpr/clipboard/clipboard.c
+++ b/winpr/libwinpr/clipboard/clipboard.c
@@ -197,7 +197,7 @@ UINT32 ClipboardGetRegisteredFormatIds(wClipboard* clipboard,
if (!pFormatIds)
{
- pFormatIds = malloc(clipboard->numFormats * sizeof(UINT32));
+ pFormatIds = calloc(clipboard->numFormats, sizeof(UINT32));
if (!pFormatIds)
return 0;
@@ -340,7 +340,7 @@ UINT32 ClipboardGetFormatIds(wClipboard* clipboard, UINT32** ppFormatIds)
if (!pFormatIds)
{
- pFormatIds = malloc(count * sizeof(UINT32));
+ pFormatIds = calloc(count, sizeof(UINT32));
if (!pFormatIds)
return 0;
diff --git a/winpr/libwinpr/clipboard/synthetic.c b/winpr/libwinpr/clipboard/synthetic.c
index 718d01c04..156e7389a 100644
--- a/winpr/libwinpr/clipboard/synthetic.c
+++ b/winpr/libwinpr/clipboard/synthetic.c
@@ -445,7 +445,7 @@ static void* clipboard_synthesize_text_html(wClipboard* clipboard, UINT32 format
beg = atoi(&begStr[10]);
end = atoi(&endStr[8]);
- if ((beg > SrcSize) || (end > SrcSize) || (beg >= end))
+ if (beg < 0 || end < 0 || (beg > SrcSize) || (end > SrcSize) || (beg >= end))
return NULL;
DstSize = end - beg;
diff --git a/winpr/libwinpr/comm/test/TestGetCommState.c b/winpr/libwinpr/comm/test/TestGetCommState.c
index f021152c1..38619aecb 100644
--- a/winpr/libwinpr/comm/test/TestGetCommState.c
+++ b/winpr/libwinpr/comm/test/TestGetCommState.c
@@ -57,7 +57,7 @@ static BOOL test_generic(HANDLE hComm)
return FALSE;
}
- pDcb = (DCB*)calloc(1, sizeof(DCB) * 2);
+ pDcb = (DCB*)calloc(2, sizeof(DCB));
if (!pDcb)
return FALSE;
pDcb->DCBlength = sizeof(DCB) * 2;
diff --git a/winpr/libwinpr/crt/test/TestUnicodeConversion.c b/winpr/libwinpr/crt/test/TestUnicodeConversion.c
index b2a103fcc..e0e13378b 100644
--- a/winpr/libwinpr/crt/test/TestUnicodeConversion.c
+++ b/winpr/libwinpr/crt/test/TestUnicodeConversion.c
@@ -138,7 +138,7 @@ int convert_utf8_to_utf16(BYTE* lpMultiByteStr, BYTE* expected_lpWideCharStr, in
return -1;
}
- lpWideCharStr = (LPWSTR) malloc(cchWideChar * sizeof(WCHAR));
+ lpWideCharStr = (LPWSTR) calloc(cchWideChar, sizeof(WCHAR));
if (!lpWideCharStr)
{
printf("MultiByteToWideChar: unable to allocate memory for test\n");
diff --git a/winpr/libwinpr/crypto/test/TestCryptoCertEnumCertificatesInStore.c b/winpr/libwinpr/crypto/test/TestCryptoCertEnumCertificatesInStore.c
index b112fc80a..837e8ff74 100644
--- a/winpr/libwinpr/crypto/test/TestCryptoCertEnumCertificatesInStore.c
+++ b/winpr/libwinpr/crypto/test/TestCryptoCertEnumCertificatesInStore.c
@@ -47,7 +47,7 @@ int TestCryptoCertEnumCertificatesInStore(int argc, char* argv[])
if (status == 0)
return -1;
- pszNameString = (LPTSTR) malloc(status * sizeof(TCHAR));
+ pszNameString = (LPTSTR) calloc(status, sizeof(TCHAR));
if (!pszNameString)
{
printf("Unable to allocate memory\n");
diff --git a/winpr/libwinpr/dsparse/test/TestDsMakeSpn.c b/winpr/libwinpr/dsparse/test/TestDsMakeSpn.c
index 11510577c..3088de968 100644
--- a/winpr/libwinpr/dsparse/test/TestDsMakeSpn.c
+++ b/winpr/libwinpr/dsparse/test/TestDsMakeSpn.c
@@ -40,7 +40,7 @@ int TestDsMakeSpn(int argc, char* argv[])
}
/* SpnLength includes null terminator */
- Spn = (LPTSTR) malloc(SpnLength * sizeof(TCHAR));
+ Spn = (LPTSTR) calloc(SpnLength, sizeof(TCHAR));
if (!Spn)
{
_tprintf(_T("DsMakeSpn: Unable to allocate memroy\n"));
diff --git a/winpr/libwinpr/environment/environment.c b/winpr/libwinpr/environment/environment.c
index 84d354c89..26d1ac617 100644
--- a/winpr/libwinpr/environment/environment.c
+++ b/winpr/libwinpr/environment/environment.c
@@ -231,7 +231,7 @@ LPCH GetEnvironmentStringsA(VOID)
envp = environ;
cchEnvironmentBlock = 128;
- lpszEnvironmentBlock = (LPCH) malloc(cchEnvironmentBlock * sizeof(CHAR));
+ lpszEnvironmentBlock = (LPCH) calloc(cchEnvironmentBlock, sizeof(CHAR));
if (!lpszEnvironmentBlock)
return NULL;
@@ -365,7 +365,7 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
offset = 0;
cchEnvironmentBlock = 128;
- lpszEnvironmentBlock = (LPCH) malloc(cchEnvironmentBlock * sizeof(CHAR));
+ lpszEnvironmentBlock = (LPCH) calloc(cchEnvironmentBlock, sizeof(CHAR));
if (!lpszEnvironmentBlock)
{
diff --git a/winpr/libwinpr/file/test/TestFileFindFirstFile.c b/winpr/libwinpr/file/test/TestFileFindFirstFile.c
index 917cf3930..7cb5678d7 100644
--- a/winpr/libwinpr/file/test/TestFileFindFirstFile.c
+++ b/winpr/libwinpr/file/test/TestFileFindFirstFile.c
@@ -21,7 +21,7 @@ int TestFileFindFirstFile(int argc, char* argv[])
#ifdef UNICODE
length = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
- BasePath = (WCHAR*) malloc((length + 1) * sizeof(WCHAR));
+ BasePath = (WCHAR*) calloc((length + 1), sizeof(WCHAR));
if (!BasePath)
{
_tprintf(_T("Unable to allocate memory\n"));
diff --git a/winpr/libwinpr/file/test/TestFileFindNextFile.c b/winpr/libwinpr/file/test/TestFileFindNextFile.c
index 20d5400b7..7b154eaad 100644
--- a/winpr/libwinpr/file/test/TestFileFindNextFile.c
+++ b/winpr/libwinpr/file/test/TestFileFindNextFile.c
@@ -23,7 +23,7 @@ int TestFileFindNextFile(int argc, char* argv[])
#ifdef UNICODE
length = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
- BasePath = (WCHAR*) malloc((length + 1) * sizeof(WCHAR));
+ BasePath = (WCHAR*) calloc((length + 1), sizeof(WCHAR));
if (!BasePath)
{
_tprintf(_T("Unable to allocate memory"));
diff --git a/winpr/libwinpr/nt/nt.c b/winpr/libwinpr/nt/nt.c
index 6d9dde908..2730ea3bb 100644
--- a/winpr/libwinpr/nt/nt.c
+++ b/winpr/libwinpr/nt/nt.c
@@ -172,7 +172,7 @@ NTSTATUS _RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString,
if (SourceString->MaximumLength)
{
- if (!(wbuf = (PWSTR) malloc(SourceString->MaximumLength * 2)))
+ if (!(wbuf = (PWSTR) calloc(SourceString->MaximumLength, 2)))
return STATUS_NO_MEMORY;
}
diff --git a/winpr/libwinpr/smartcard/smartcard_pcsc.c b/winpr/libwinpr/smartcard/smartcard_pcsc.c
index b167741bd..5a3d7eaa1 100644
--- a/winpr/libwinpr/smartcard/smartcard_pcsc.c
+++ b/winpr/libwinpr/smartcard/smartcard_pcsc.c
@@ -797,7 +797,7 @@ char* PCSC_ConvertReaderNamesToWinSCard(const char* names, LPDWORD pcchReaders)
BOOL allReaders = FALSE;
p = (char*) names;
cchReaders = *pcchReaders;
- namesWinSCard = (char*) malloc(cchReaders * 2);
+ namesWinSCard = (char*) calloc(cchReaders, 2);
if (!namesWinSCard)
return NULL;
@@ -865,7 +865,7 @@ char* PCSC_ConvertReaderNamesToPCSC(const char* names, LPDWORD pcchReaders)
DWORD cchReaders;
p = (char*) names;
cchReaders = *pcchReaders;
- namesPCSC = (char*) malloc(cchReaders * 2);
+ namesPCSC = (char*) calloc(cchReaders, 2);
if (!namesPCSC)
return NULL;
diff --git a/winpr/libwinpr/sspi/sspi_winpr.c b/winpr/libwinpr/sspi/sspi_winpr.c
index 12d7b7ca1..ec41f5632 100644
--- a/winpr/libwinpr/sspi/sspi_winpr.c
+++ b/winpr/libwinpr/sspi/sspi_winpr.c
@@ -416,7 +416,7 @@ int sspi_CopyAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, SEC_WINNT_AUTH_IDEN
if (identity->UserLength > 0)
{
- identity->User = (UINT16*) malloc((identity->UserLength + 1) * sizeof(WCHAR));
+ identity->User = (UINT16*) calloc((identity->UserLength + 1), sizeof(WCHAR));
if (!identity->User)
return -1;
@@ -429,7 +429,7 @@ int sspi_CopyAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, SEC_WINNT_AUTH_IDEN
if (identity->DomainLength > 0)
{
- identity->Domain = (UINT16*) malloc((identity->DomainLength + 1) * sizeof(WCHAR));
+ identity->Domain = (UINT16*) calloc((identity->DomainLength + 1), sizeof(WCHAR));
if (!identity->Domain)
return -1;
@@ -445,7 +445,7 @@ int sspi_CopyAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, SEC_WINNT_AUTH_IDEN
if (srcIdentity->Password)
{
- identity->Password = (UINT16*) malloc((identity->PasswordLength + 1) * sizeof(WCHAR));
+ identity->Password = (UINT16*) calloc((identity->PasswordLength + 1), sizeof(WCHAR));
if (!identity->Password)
return -1;
diff --git a/winpr/libwinpr/thread/argv.c b/winpr/libwinpr/thread/argv.c
index cdef7d2ec..6739150eb 100644
--- a/winpr/libwinpr/thread/argv.c
+++ b/winpr/libwinpr/thread/argv.c
@@ -114,7 +114,7 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
numArgs = 0;
lpEscapedCmdLine = NULL;
cmdLineLength = (int) strlen(lpCmdLine);
- lpEscapedChars = (BOOL*) calloc(1, (cmdLineLength + 1) * sizeof(BOOL));
+ lpEscapedChars = (BOOL*) calloc(cmdLineLength + 1, sizeof(BOOL));
if (!lpEscapedChars)
return NULL;
@@ -123,7 +123,7 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
{
int i, n;
char* pLastEnd = NULL;
- lpEscapedCmdLine = (char*) malloc((cmdLineLength + 1) * sizeof(char));
+ lpEscapedCmdLine = (char*) calloc(cmdLineLength + 1, sizeof(char));
if (!lpEscapedCmdLine)
{
diff --git a/winpr/libwinpr/utils/collections/ArrayList.c b/winpr/libwinpr/utils/collections/ArrayList.c
index d22b4891c..95d6f9a51 100644
--- a/winpr/libwinpr/utils/collections/ArrayList.c
+++ b/winpr/libwinpr/utils/collections/ArrayList.c
@@ -456,7 +456,7 @@ wArrayList *ArrayList_New(BOOL synchronized)
arrayList->capacity = 32;
arrayList->growthFactor = 2;
arrayList->object.fnObjectEquals = ArrayList_DefaultCompare;
- arrayList->array = (void **)malloc(arrayList->capacity * sizeof(void *));
+ arrayList->array = (void **)calloc(arrayList->capacity, sizeof(void *));
if (!arrayList->array)
goto out_free;
diff --git a/winpr/libwinpr/utils/collections/BufferPool.c b/winpr/libwinpr/utils/collections/BufferPool.c
index 8067ae081..1e805c5c8 100644
--- a/winpr/libwinpr/utils/collections/BufferPool.c
+++ b/winpr/libwinpr/utils/collections/BufferPool.c
@@ -452,7 +452,7 @@ wBufferPool* BufferPool_New(BOOL synchronized, int fixedSize, DWORD alignment)
pool->size = 0;
pool->capacity = 32;
- pool->array = (void**) malloc(sizeof(void*) * pool->capacity);
+ pool->array = (void**) calloc(pool->capacity, sizeof(void*));
if (!pool->array)
goto out_error;
}
@@ -462,13 +462,13 @@ wBufferPool* BufferPool_New(BOOL synchronized, int fixedSize, DWORD alignment)
pool->aSize = 0;
pool->aCapacity = 32;
- pool->aArray = (wBufferPoolItem*) malloc(sizeof(wBufferPoolItem) * pool->aCapacity);
+ pool->aArray = (wBufferPoolItem*) calloc(pool->aCapacity, sizeof(wBufferPoolItem));
if (!pool->aArray)
goto out_error;
pool->uSize = 0;
pool->uCapacity = 32;
- pool->uArray = (wBufferPoolItem*) malloc(sizeof(wBufferPoolItem) * pool->uCapacity);
+ pool->uArray = (wBufferPoolItem*) calloc(pool->uCapacity, sizeof(wBufferPoolItem));
if (!pool->uArray)
{
free(pool->aArray);
diff --git a/winpr/libwinpr/utils/collections/ObjectPool.c b/winpr/libwinpr/utils/collections/ObjectPool.c
index 3839970f2..3eb573687 100644
--- a/winpr/libwinpr/utils/collections/ObjectPool.c
+++ b/winpr/libwinpr/utils/collections/ObjectPool.c
@@ -129,7 +129,7 @@ wObjectPool* ObjectPool_New(BOOL synchronized)
{
pool->capacity = 32;
pool->size = 0;
- pool->array = (void**) malloc(sizeof(void*) * pool->capacity);
+ pool->array = (void**) calloc(pool->capacity, sizeof(void*));
if (!pool->array)
{
free(pool);
diff --git a/winpr/libwinpr/utils/collections/PubSub.c b/winpr/libwinpr/utils/collections/PubSub.c
index 54a5a283b..de9d88b87 100644
--- a/winpr/libwinpr/utils/collections/PubSub.c
+++ b/winpr/libwinpr/utils/collections/PubSub.c
@@ -218,7 +218,7 @@ wPubSub* PubSub_New(BOOL synchronized)
pubSub->count = 0;
pubSub->size = 64;
- pubSub->events = (wEventType*) calloc(1, sizeof(wEventType) * pubSub->size);
+ pubSub->events = (wEventType*) calloc(pubSub->size, sizeof(wEventType));
if (!pubSub->events)
{
if (pubSub->synchronized)
diff --git a/winpr/libwinpr/utils/collections/Stack.c b/winpr/libwinpr/utils/collections/Stack.c
index 008d63b63..14b2d79c4 100644
--- a/winpr/libwinpr/utils/collections/Stack.c
+++ b/winpr/libwinpr/utils/collections/Stack.c
@@ -206,7 +206,7 @@ wStack* Stack_New(BOOL synchronized)
stack->synchronized = synchronized;
stack->capacity = 32;
- stack->array = (void**) malloc(sizeof(void*) * stack->capacity);
+ stack->array = (void**) calloc(stack->capacity, sizeof(void*));
if (!stack->array)
goto out_free;
diff --git a/winpr/libwinpr/utils/debug.c b/winpr/libwinpr/utils/debug.c
index 4d1090c49..4c2d0db66 100644
--- a/winpr/libwinpr/utils/debug.c
+++ b/winpr/libwinpr/utils/debug.c
@@ -396,7 +396,7 @@ char** winpr_backtrace_symbols(void* buffer, size_t* used)
size_t array_size = data->used * sizeof(char*);
size_t lines_size = data->used * line_len;
char **vlines = calloc(1, array_size + lines_size);
- SYMBOL_INFO* symbol = calloc(sizeof(SYMBOL_INFO) + line_len * sizeof(char), 1);
+ SYMBOL_INFO* symbol = calloc(1, sizeof(SYMBOL_INFO) + line_len * sizeof(char));
IMAGEHLP_LINE64* line = (IMAGEHLP_LINE64*) calloc(1, sizeof(IMAGEHLP_LINE64));
if (!vlines || !symbol || !line)
diff --git a/winpr/libwinpr/utils/ini.c b/winpr/libwinpr/utils/ini.c
index 9cad4d321..9bbf45f1c 100644
--- a/winpr/libwinpr/utils/ini.c
+++ b/winpr/libwinpr/utils/ini.c
@@ -227,7 +227,7 @@ wIniFileSection* IniFile_Section_New(const char* name)
section->nKeys = 0;
section->cKeys = 64;
- section->keys = (wIniFileKey**) malloc(sizeof(wIniFileKey*) * section->cKeys);
+ section->keys = (wIniFileKey**) calloc(section->cKeys, sizeof(wIniFileKey*));
if (!section->keys)
{
diff --git a/winpr/libwinpr/utils/lodepng/lodepng.c b/winpr/libwinpr/utils/lodepng/lodepng.c
index 0d4bf154a..36902ce5e 100644
--- a/winpr/libwinpr/utils/lodepng/lodepng.c
+++ b/winpr/libwinpr/utils/lodepng/lodepng.c
@@ -766,8 +766,8 @@ unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequen
For every symbol, maxbitlen coins will be created*/
coinmem = numpresent * 2; /*max amount of coins needed with the current algo*/
- coins = (Coin*)malloc(sizeof(Coin) * coinmem);
- prev_row = (Coin*)malloc(sizeof(Coin) * coinmem);
+ coins = (Coin*)calloc(sizeof(Coin), coinmem);
+ prev_row = (Coin*)calloc(sizeof(Coin), coinmem);
if(!coins || !prev_row)
{
free(coins);
@@ -1353,13 +1353,13 @@ typedef struct Hash
static unsigned hash_init(Hash* hash, unsigned windowsize)
{
unsigned i;
- hash->head = (int*)malloc(sizeof(int) * HASH_NUM_VALUES);
- hash->val = (int*)malloc(sizeof(int) * windowsize);
- hash->chain = (unsigned short*)malloc(sizeof(unsigned short) * windowsize);
+ hash->head = (int*)calloc(sizeof(int), HASH_NUM_VALUES);
+ hash->val = (int*)calloc(sizeof(int), windowsize);
+ hash->chain = (unsigned short*)calloc(sizeof(unsigned short), windowsize);
- hash->zeros = (unsigned short*)malloc(sizeof(unsigned short) * windowsize);
- hash->headz = (int*)malloc(sizeof(int) * (MAX_SUPPORTED_DEFLATE_LENGTH + 1));
- hash->chainz = (unsigned short*)malloc(sizeof(unsigned short) * windowsize);
+ hash->zeros = (unsigned short*)calloc(sizeof(unsigned short), windowsize);
+ hash->headz = (int*)calloc(sizeof(int), (MAX_SUPPORTED_DEFLATE_LENGTH + 1));
+ hash->chainz = (unsigned short*)calloc(sizeof(unsigned short), windowsize);
if(!hash->head || !hash->chain || !hash->val || !hash->headz|| !hash->chainz || !hash->zeros)
{
diff --git a/winpr/libwinpr/utils/ntlm.c b/winpr/libwinpr/utils/ntlm.c
index 7dd05eeb3..771b358cc 100644
--- a/winpr/libwinpr/utils/ntlm.c
+++ b/winpr/libwinpr/utils/ntlm.c
@@ -58,7 +58,7 @@ BYTE* NTOWFv1A(LPSTR Password, UINT32 PasswordLength, BYTE* NtHash)
{
LPWSTR PasswordW = NULL;
- if (!(PasswordW = (LPWSTR) malloc(PasswordLength * 2)))
+ if (!(PasswordW = (LPWSTR) calloc(PasswordLength, 2)))
return NULL;
MultiByteToWideChar(CP_ACP, 0, Password, PasswordLength, PasswordW, PasswordLength);
@@ -124,9 +124,9 @@ BYTE* NTOWFv2A(LPSTR Password, UINT32 PasswordLength, LPSTR User,
LPWSTR DomainW = NULL;
LPWSTR PasswordW = NULL;
- UserW = (LPWSTR) malloc(UserLength * 2);
- DomainW = (LPWSTR) malloc(DomainLength * 2);
- PasswordW = (LPWSTR) malloc(PasswordLength * 2);
+ UserW = (LPWSTR) calloc(UserLength, 2);
+ DomainW = (LPWSTR) calloc(DomainLength, 2);
+ PasswordW = (LPWSTR) calloc(PasswordLength, 2);
if (!UserW || !DomainW || !PasswordW)
goto out_fail;
@@ -186,8 +186,8 @@ BYTE* NTOWFv2FromHashA(BYTE* NtHashV1, LPSTR User, UINT32 UserLength, LPSTR Doma
LPWSTR UserW = NULL;
LPWSTR DomainW = NULL;
- UserW = (LPWSTR) malloc(UserLength * 2);
- DomainW = (LPWSTR) malloc(DomainLength * 2);
+ UserW = (LPWSTR) calloc(UserLength, 2);
+ DomainW = (LPWSTR) calloc(DomainLength, 2);
if (!UserW || !DomainW)
goto out_fail;
diff --git a/winpr/tools/makecert/makecert.c b/winpr/tools/makecert/makecert.c
index 2fdb71690..a9efb352c 100644
--- a/winpr/tools/makecert/makecert.c
+++ b/winpr/tools/makecert/makecert.c
@@ -365,7 +365,7 @@ static char* x509_get_default_name(void)
GetLastError() != ERROR_MORE_DATA)
goto fallback;
- computerName = (CHAR*)calloc(nSize, 1);
+ computerName = (CHAR*)calloc(1, nSize);
if (!computerName)
goto fallback;
@@ -381,7 +381,7 @@ fallback:
GetLastError() != ERROR_MORE_DATA)
return NULL;
- computerName = (CHAR*)calloc(nSize, 1);
+ computerName = (CHAR*)calloc(1, nSize);
if (!computerName)
return NULL;