From 7dca3fd954a9a76f5a62aa8bf38a43423304f88d Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Sun, 27 Jul 2025 20:02:18 -0700 Subject: [PATCH] os/gfx/win32: fix bad alloc size in new utf16 clipboard path --- src/os/gfx/win32/os_gfx_win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/gfx/win32/os_gfx_win32.c b/src/os/gfx/win32/os_gfx_win32.c index 8385d188..dac8bde7 100644 --- a/src/os/gfx/win32/os_gfx_win32.c +++ b/src/os/gfx/win32/os_gfx_win32.c @@ -1001,7 +1001,7 @@ os_set_clipboard_text(String8 string) { EmptyClipboard(); String16 string16 = str16_from_8(scratch.arena, string); - HANDLE string16_copy_handle = GlobalAlloc(GMEM_MOVEABLE, string16.size*sizeof(string16.str[0])+1); + HANDLE string16_copy_handle = GlobalAlloc(GMEM_MOVEABLE, (string16.size+1)*sizeof(string16.str[0])); if(string16_copy_handle) { U16 *copy_buffer = (U16 *)GlobalLock(string16_copy_handle);