From df321f8d4200cd3d5d80c798d7db937c6ebc093c Mon Sep 17 00:00:00 2001 From: insofaras Date: Tue, 8 Mar 2016 23:25:56 +0000 Subject: [PATCH] fix 'a-x open all code' crash in linux system_set_file --- linux_4ed.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linux_4ed.cpp b/linux_4ed.cpp index b3a28234..f1c069af 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -319,9 +319,11 @@ Sys_Set_File_List_Sig(system_set_file_list){ File_Info *info_ptr; i32 count, file_count, size, required_size; - terminate_with_null(&directory); + char* dir = (char*) alloca(directory.size + 1); + memcpy(dir, directory.str, directory.size); + dir[directory.size] = 0; - d = opendir(directory.str); + d = opendir(dir); if (d){ count = 0; file_count = 0;