From 0994ee67ce94ee6a5c29a687498e29d0745168e4 Mon Sep 17 00:00:00 2001 From: Alex Leitner Date: Fri, 19 Jul 2024 16:37:47 -0400 Subject: [PATCH] GUACAMOLE-1971: Safely multiply values to be used for memory allocation. --- src/protocols/rdp/pointer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/protocols/rdp/pointer.c b/src/protocols/rdp/pointer.c index 1d4a4e899..861e90670 100644 --- a/src/protocols/rdp/pointer.c +++ b/src/protocols/rdp/pointer.c @@ -30,6 +30,7 @@ #include #include #include +#include #include BOOL guac_rdp_pointer_new(rdpContext* context, rdpPointer* pointer) { @@ -42,7 +43,8 @@ BOOL guac_rdp_pointer_new(rdpContext* context, rdpPointer* pointer) { rdp_client->display, pointer->width, pointer->height); /* Allocate data for image */ - unsigned char* data = GUAC_ALIGNED_MALLOC(pointer->width * pointer->height * 4, 16); + unsigned char* data = GUAC_ALIGNED_MALLOC(guac_mem_ckd_mul_or_die(pointer->width, + pointer->height, 4), 16); cairo_surface_t* surface;