From 24a23e3028d61e192d5fc0866bee7d42147b5612 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Feb 2026 08:30:24 +0100 Subject: [PATCH] [codec,nsc] deprecate nsc_decompose_message this function is just a wrapper around nsc_process_message with some wStream handling around it. Since proper length checks are missing deprecate it completely. --- include/freerdp/codec/nsc.h | 15 +++++++++++---- libfreerdp/codec/nsc_encode.c | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/freerdp/codec/nsc.h b/include/freerdp/codec/nsc.h index b100ae305..d7b9854ef 100644 --- a/include/freerdp/codec/nsc.h +++ b/include/freerdp/codec/nsc.h @@ -84,10 +84,17 @@ extern "C" wStream* WINPR_RESTRICT s, const BYTE* WINPR_RESTRICT bmpdata, UINT32 width, UINT32 height, UINT32 rowstride); - FREERDP_API BOOL nsc_decompose_message(NSC_CONTEXT* WINPR_RESTRICT context, - wStream* WINPR_RESTRICT s, BYTE* WINPR_RESTRICT bmpdata, - UINT32 x, UINT32 y, UINT32 width, UINT32 height, - UINT32 rowstride, UINT32 format, UINT32 flip); + +#if !defined(WITHOUT_FREERDP_3x_DEPRECATED) + + WINPR_DEPRECATED_VAR( + "[since 3.23.0] deprecated, insecure! missing length checks. use nsc_process_message", + FREERDP_API BOOL nsc_decompose_message(NSC_CONTEXT* WINPR_RESTRICT context, + wStream* WINPR_RESTRICT s, + BYTE* WINPR_RESTRICT bmpdata, UINT32 x, UINT32 y, + UINT32 width, UINT32 height, UINT32 rowstride, + UINT32 format, UINT32 flip)); +#endif FREERDP_API BOOL nsc_context_reset(NSC_CONTEXT* WINPR_RESTRICT context, UINT32 width, UINT32 height); diff --git a/libfreerdp/codec/nsc_encode.c b/libfreerdp/codec/nsc_encode.c index b0fa8f4f2..ec6f282e1 100644 --- a/libfreerdp/codec/nsc_encode.c +++ b/libfreerdp/codec/nsc_encode.c @@ -495,6 +495,7 @@ BOOL nsc_compose_message(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RES return nsc_write_message(context, s, &message); } +#if !defined(WITHOUT_FREERDP_3x_DEPRECATED) BOOL nsc_decompose_message(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RESTRICT s, BYTE* WINPR_RESTRICT bmpdata, UINT32 x, UINT32 y, UINT32 width, UINT32 height, UINT32 rowstride, UINT32 format, UINT32 flip) @@ -511,3 +512,4 @@ BOOL nsc_decompose_message(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_R Stream_Seek(s, size); return TRUE; } +#endif