From f62bef13d59fb7cb3da1b65d18adf837ad34c518 Mon Sep 17 00:00:00 2001 From: Doczom Date: Sun, 14 Nov 2021 14:02:16 +0000 Subject: [PATCH] fixing a memory leak in the clipboard git-svn-id: svn://kolibrios.org@9265 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/clipboard.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/trunk/core/clipboard.inc b/kernel/trunk/core/clipboard.inc index ffb70abbe3..fc345d2d8d 100644 --- a/kernel/trunk/core/clipboard.inc +++ b/kernel/trunk/core/clipboard.inc @@ -50,14 +50,12 @@ align 4 dec ebx ; 2 - Write the data to the clipboard jnz .3 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; check pointer on kernel address stdcall is_region_userspace, edx, ecx jz @f mov eax, -1 jmp .exit_1 @@: -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ; check the lock mov ebx, clipboard_write_lock xor eax, eax @@ -81,6 +79,8 @@ align 4 shl eax, 2 add eax, [clipboard_main_list] mov [eax], edi + push edi ;save pointer to data + push ecx ;save size data ; copy the data into the slot mov esi, edx mov eax, ecx @@ -89,6 +89,10 @@ align 4 sub ecx, 4 add esi, 4 rep movsb ; store slot data +;copy ecx in Dword[clipboard_main_list+clipboard_slots*4] + pop ecx + pop eax + mov [eax], ecx ; increase the counter of slots inc [clipboard_slots] ; unlock last slot