From 22e9386a23297dba3fb427675975aeea3440f6cb Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sun, 13 Mar 2016 10:30:38 +0000 Subject: [PATCH] kernel: set maximum length of a stored application path name to 1023 bytes git-svn-id: svn://kolibrios.org@6338 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/taskman.inc | 18 +++++++++++++++--- kernel/trunk/fs/fs_lfn.inc | 21 +++++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index f2515b0600..8f645d56d4 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -870,23 +870,35 @@ common_app_entry: .copy_full_path: mov esi, [current_slot] mov esi, [esi+APPDATA.cur_dir] + mov ebx, 1023 mov al, '/' stosb -@@: + +.copy_path: + dec ebx + jz .finish_path lodsb stosb test al, al - jnz @B + jnz .copy_path mov byte [edi-1], '/' + cmp ecx, ebx + jbe @F + mov ecx, ebx +@@: lea esi, [ebp+sizeof.APP_HDR] xor eax, eax rep movsb stosb jmp .check_cmdline -.copy_filename: +.finish_path: + xor eax, eax + stosb + jmp .check_cmdline +.copy_filename: cmp byte [esi], '/' jne .copy_full_path diff --git a/kernel/trunk/fs/fs_lfn.inc b/kernel/trunk/fs/fs_lfn.inc index 4554ab0908..c134607a20 100644 --- a/kernel/trunk/fs/fs_lfn.inc +++ b/kernel/trunk/fs/fs_lfn.inc @@ -135,6 +135,19 @@ file_system_lfn: lodsb @@: lea ebp, [esi-1] +if 0 + cmp [ebx], dword 0 + jne @F + DEBUGF 1,'read file %s\n',ebp + jmp .1 +@@: + cmp [ebx], dword 5 + jne @F + DEBUGF 1,'get file attributes %s\n',ebp +@@: +.1: +end if + cmp dword [ebx], 7 jne @F mov edx, [ebx+4] @@ -734,7 +747,7 @@ process_replace_file_name: uglobal lock_flag_for_f30_3 rb 1 endg - + sys_current_directory: ; mov esi, [current_slot] ; mov esi, [esi+APPDATA.cur_dir] @@ -759,7 +772,7 @@ sys_current_directory: ; check lock of the function cmp [lock_flag_for_f30_3], 1 je @f - + mov esi, ecx mov edi, sysdir_name1 ; copying fake directory name @@ -778,7 +791,7 @@ sys_current_directory: ; terminator of name, in case if we get the inlet trash xor eax, eax stosb -; increase the pointer of inputs for procedure "process_replace_file_name" +; increase the pointer of inputs for procedure "process_replace_file_name" mov [full_file_name_table.size], 2 ; block the ability to call f.30.3 because for one session is necessary ; for us only once @@ -786,7 +799,7 @@ sys_current_directory: popfd @@: ret - + .get: ; sysfunction 30.2: [for app] eax=30,ebx=2,ecx->buffer,edx=len ; for our code: ebx->buffer,ecx=len