Skip to content

Commit 8651022

Browse files
authored
GUACAMOLE-1971: Merge safely multiply values to be used for memory allocation.
2 parents c715f16 + 9860229 commit 8651022

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/protocols/rdp/pointer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <freerdp/freerdp.h>
3030
#include <freerdp/gdi/gdi.h>
3131
#include <guacamole/client.h>
32+
#include <guacamole/mem.h>
3233
#include <winpr/crt.h>
3334

3435
BOOL guac_rdp_pointer_new(rdpContext* context, rdpPointer* pointer) {
@@ -41,7 +42,8 @@ BOOL guac_rdp_pointer_new(rdpContext* context, rdpPointer* pointer) {
4142
rdp_client->display, pointer->width, pointer->height);
4243

4344
/* Allocate data for image */
44-
unsigned char* data = _aligned_malloc(pointer->width * pointer->height * 4, 16);
45+
unsigned char* data = _aligned_malloc(guac_mem_ckd_mul_or_die(pointer->width,
46+
pointer->height, 4), 16);
4547

4648
cairo_surface_t* surface;
4749

@@ -122,4 +124,3 @@ BOOL guac_rdp_pointer_set_default(rdpContext* context) {
122124

123125
return TRUE;
124126
}
125-

0 commit comments

Comments
 (0)